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
-
RThurman Posts: 2,880
@jsorr2 -- Curiosity go to me so I cobbled together three examples of making text scroll with the rubber band effect.
The basic idea is to create two control structures that try to keep:
1) the top of the text box near the top of the display
2) the bottom of the text box near the bottom of the displayAnd then to have a third control structure that tries to follow the mouse.
The attached demo has three actors that do the same thing in slightly different ways.
1)Actor one uses three move behaviors to get the job done.
2)Actor two combines the three move behaviors into one move (with a huge equation).
3)Actor three uses one constrain behavior (along with the huge equation).Three different ways to do it in GameSalad (but the same math).
Here is the link:
http://www.mediafire.com/download/gc1bgo80j9ijotj/kineticScrollingFinal.zipThis was fun to make.
Hope its useful!
Answers
like this
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.
Brilliant stuff !
Will definitely check it out when i get home. Will edit this post when i do. Thanks for the efforts
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.
@Socks -- Its not that bad! It basically boils down to:
Velocity = DistanceFromDisplayTop - DistanceFromDisplayBottom + DistanceMouseMoved
Oh, I knew that's what it meant.
I like the first option the best. Seems more fluid in my opinion. Thank you so much @RThurman. This will be so useful.
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.
@RThurman Very useful .. Thanks for sharing
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
@sawkastee it would need to be in every actor manually. Of course you could just spawn duplicate actors with the code in it already.
@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?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@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?