GameSalad

Howdy, Stranger!

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

mimicking scroll up and down of apple apps

With the text message app in ios phones, you can scroll up and the more you scroll, the slower the screen moves until it stops. When you release your finger it snaps back to it's original position. How can I achieve this in game salad?

Best Answer

Answers

  • jsorr2jsorr2 Member Posts: 279
    edited January 2015
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,849

    This was Steve Jobs favorite patent! (#381) When he saw the effect he cancelled plans for an apple tablet and went straight for developing an apple phone instead. They called it "inertial scrolling."

    You probably want to search for "momentum scrolling" or "kinetic scrolling" or perhaps "rubber banding" effect.

  • SocksSocks London, UK.Member Posts: 12,822

    @RThurman said:
    jsorr2 -- Curiosity go to me . . .

    Brilliant stuff ! :)

  • jsorr2jsorr2 Member Posts: 279

    Will definitely check it out when i get home. Will edit this post when i do. Thanks for the efforts :)

  • SocksSocks London, UK.Member Posts: 12,822

    yeah, I thought it would be this . . .

    (max(0, game.Display Size.Height -( self.Position.Y +( self.Size.Height /2))) *10) -(max(0,( self.Position.Y - self.Size.Height /2)) *10)+ ( self.mouseDelta *1) *15

    . . . pretty obvious actually.

    :p

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,849

    @Socks -- Its not that bad! It basically boils down to:

    Velocity = DistanceFromDisplayTop - DistanceFromDisplayBottom + DistanceMouseMoved

  • SocksSocks London, UK.Member Posts: 12,822

    @RThurman said:
    Socks -- Its not that bad! It basically boils down to:

    Velocity = DistanceFromDisplayTop - DistanceFromDisplayBottom + DistanceMouseMoved

    Oh, I knew that's what it meant. :)

  • jsorr2jsorr2 Member Posts: 279

    I like the first option the best. Seems more fluid in my opinion. Thank you so much @RThurman‌. This will be so useful.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,849

    Glad it will work for you!

    I like the first way also. Its definitely easier to understand what is going on. And, I like the way that move behaviors are additive. But I was not sure of the efficiency of having three move behaviors. If (due to other elements in your game) the fps start to go down then you might need to switch to a method that only uses one constrain behavior. It might be more efficient than using three separate move behaviors.

  • beefy_clyrobeefy_clyro Member Posts: 5,390

    @RThurman‌ Very useful .. Thanks for sharing

  • sawkasteesawkastee Member Posts: 184

    Any way to group actors and use this scrolling method? I have a scene where actors are spawned dynamically based on the number of rows in a table. I'd like all the spawned actor (rows) to use this scrolling method. Thanks

  • jsorr2jsorr2 Member Posts: 279

    @sawkastee it would need to be in every actor manually. Of course you could just spawn duplicate actors with the code in it already.

  • jamie_cjamie_c ImagineLabs.rocks Member, BASIC Posts: 5,590
    edited January 2015

    @sawkastee, I honestly haven't looked at the file attached above, but I did a scrolling menu in this thread:

    http://forums.gamesalad.com/discussion/75220/fast-constrain-linkmachine-v2

    That used @Socks 'fast constrain', maybe the two could be combined?

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,849

    @beefy_clyro -- glad it will be useful for you!

    @sawkastee -- yes. But wouldn't it be easier (and more efficient) to have one text box and append the value of each table cell to a new row in the text block?

Sign In or Register to comment.