I'm trying to achieve something, and after searching for some ideas here, found nothing (or did not know how to properly search )
I'm working on a game concept in which objects pile on top of others. When they reach a certain object (which I already detect by collision with an invisible sprite), I want the object pile to move down smoothly by a certain amount of pixels, so the objects never reach the top of the screen.
Which is a proper way of making it?
Thanks in advance for any help.
Develop games in your browser. Powerful, performant & highly capable.
That's a really good question.
There's probably lots of ways to do it, but I played around and found 2 possibilities. You can download my capx here.
Press "space" to run a cycle. The orange blocks use the sine behavior, and the blue ones use bullet. Neither method gets you the exact position you want, especially if the framerate varies, so both sets of blocks set their positions explicitly when a cycle ends.
If I only had these 2 to choose between, I would probably go with sine. You might be able to play with the "period" settings and the duration of the timer to get motion closer to exactly what you want.
P.S. Google drive is a little weird for capx files. When the screen comes up, just click the download button at the top.
Thanks calebbennetts! It helped a lot. I've used the sine approach, as you suggested - now I've got to polish the way items behave when piled up, so they won't fall due to ground moving down 8)