http403 Posted July 16, 2015 Share Posted July 16, 2015 I'm new to phaser and I'm trying to develop a feature and need some help or ideas on how to do it. I have a group of images:var images = game.add.group() And I want that every time user clicks on the screen all the group of images scroll down smoothly. For example if user click three times very fast, the group of images scroll 3 positions down, one at a time. I tried to increase the y position on the click event, but that changes the position of each image instantly. Do you have any ideas on how to do it? Link to comment Share on other sites More sharing options...
Skeptron Posted July 17, 2015 Share Posted July 17, 2015 It should be pretty easy : when the user clicks, you increment a variable, let's say scrollYPosition, which you set to the new coordinates at which the group is supposed to move, and at each update you actually slightly change the groups' coordinates to go to this position. For example, group is at (0, 0), user clicks : you store (0, 10). At each update you increment the group's Y by 1, so that after 10 updates the group has effectively moved to (0, 10). If you want it to be even smoother, you can decrease the increment added each loop. Link to comment Share on other sites More sharing options...
Recommended Posts