GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

kinetic scroll menu

app_sauceapp_sauce Posts: 206Member, PRO

I found a template by @RThurman that shows how to do a kinetic scroll. I like the way it works but am trying to make some slight changes. The expression is constrain self.linearmotion.y to (max(0, game.Display Size.Height -( self.Position.Y +( self.Size.Height /2)))15) -(max(0,( self.Position.Y - self.Size.Height /2))15)+ ( self.mouseDelta *15). This expression works when the camera's y origin is at 0. But when I enlarge the scene height to 1000 and move the camera all the way to the top of the scene and move the scrolling object all the way to the top of the scene it doesn't work properly. The template can be found at http://forums.gamesalad.com/discussion/comment/517308#Comment_517308 . I think my problem is happening because the above equation uses the display.size as the top of the screen, but when I make the scene size bigger and move the camera to the top of the scene the display.size.height is no longer the top top of the scene. Thanks

SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE

Comments

  • SocksSocks London, UK.Posts: 12,822Member
    edited November 2015

    //

  • app_sauceapp_sauce Posts: 206Member, PRO

    @Socks no worries I'm still trying to figure it out. I am having trouble getting my head around the equation(in the context that I need to use it). The difference between the top of the scene and the top of the actor is 0 and the difference between the bottom of the scene and the bottom of the actor is 0. I am trying to figure out a factor to add to the equation but I'm not having any luck.

    SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE

  • SocksSocks London, UK.Posts: 12,822Member
    edited November 2015

    @app_sauce said:
    I am trying to figure out a factor to add to the equation but I'm not having any luck.

    I think it's an absolute value rather than a factor, try + camera origin Y ?

    But to be honest it's hard for anyone to comment as 'it doesn't work properly' could mean anything.

  • app_sauceapp_sauce Posts: 206Member, PRO

    Yea, I got it working. Just add the camera origin y to change the top "snap back" and subtract the camera origin for the bottom. Thanks as always.

    SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE

  • app_sauceapp_sauce Posts: 206Member, PRO
    edited November 2015

    I changed the expression to (max(0,scene.Camera.Origin.Y+ game.Display Size.Height -( self.Position.Y +( self.Size.Height /2)))15) -(max(0,( self.Position.Y - self.Size.Height /2)-scene.Camera.Origin.Y)15)+ ( self.mouseDelta *15). To add a kinetic scroll to a large scene where your camera origin isn't 0,0.

    SocializeTwitter , **My Site ** **Play Loop Zen Free **iOS HERE, Google Play HERE

Sign In or Register to comment.