how to animate wall to move continuously

Hi I’m very at beginning of developing with Corona, and as a first project to learn I chose a game which has to walls on side and a ballon in middle. Now I want to move walls continuously and should seem that ballon is flying up, and with swipe over the screen the ballon should move left or right.

For the moment I need how to move this walls continuously to repeat the animation.

Any tip on how to start this ???

Thank You [import]uid: 197049 topic_id: 34385 reply_id: 334385[/import]

Take a look at the transition library in the API documentation (link at top.)

Then you’ll be wanting the applyLinearForce from the physics library. [import]uid: 8271 topic_id: 34385 reply_id: 136659[/import]

Hi thank you for reply, but in documentation I can’t find applyLinearForce

May you just write some short example how to do this.

Thank You very much [import]uid: 197049 topic_id: 34385 reply_id: 136661[/import]

Oops, sorry:

http://docs.coronalabs.com/api/type/Body/applyForce.html [import]uid: 8271 topic_id: 34385 reply_id: 136662[/import]

You can also change the wall’s Y axis in the enterFrame event (assuming the walls are up and down). You would need to set up 2 identical wall graphics (for each wall), and move the Y position at whatever speed you’d like every frame. when the first graphic reaches the bottom of the screen, bring in the second graphic, then move the first one back to the top of the screen. [import]uid: 132483 topic_id: 34385 reply_id: 136674[/import]

Thank You, I’m just trying to do that :slight_smile:

That’s hope I will do fine. [import]uid: 197049 topic_id: 34385 reply_id: 136676[/import]

There’s a tutorial at http://thatssopanda.com/creating-a-horizontal-scrolling-background-in-corona-sdk/ that may help you. [import]uid: 14218 topic_id: 34385 reply_id: 136681[/import]

Thank You very much I did it.

Now I need a swipe gesture, i.e. when player swipe to right the object should move from left side to center if swipe it again it goes to right side.

I’m trying to make a swipe gesture but I can’t find the right way, any help??? [import]uid: 197049 topic_id: 34385 reply_id: 136708[/import]

(Should be a new thread, but…) You want to check the positions received by the touch listener. Just check for the difference in the X values being more than the different in Y values. There are gestures libraries, but not many good ones, if you wanted to go the complex route. I think you just need to clearly think about how the maths would be considered and then apply the algebra to your code. [import]uid: 8271 topic_id: 34385 reply_id: 136753[/import]

Take a look at the transition library in the API documentation (link at top.)

Then you’ll be wanting the applyLinearForce from the physics library. [import]uid: 8271 topic_id: 34385 reply_id: 136659[/import]

Hi thank you for reply, but in documentation I can’t find applyLinearForce

May you just write some short example how to do this.

Thank You very much [import]uid: 197049 topic_id: 34385 reply_id: 136661[/import]

Oops, sorry:

http://docs.coronalabs.com/api/type/Body/applyForce.html [import]uid: 8271 topic_id: 34385 reply_id: 136662[/import]

You can also change the wall’s Y axis in the enterFrame event (assuming the walls are up and down). You would need to set up 2 identical wall graphics (for each wall), and move the Y position at whatever speed you’d like every frame. when the first graphic reaches the bottom of the screen, bring in the second graphic, then move the first one back to the top of the screen. [import]uid: 132483 topic_id: 34385 reply_id: 136674[/import]

Thank You, I’m just trying to do that :slight_smile:

That’s hope I will do fine. [import]uid: 197049 topic_id: 34385 reply_id: 136676[/import]

There’s a tutorial at http://thatssopanda.com/creating-a-horizontal-scrolling-background-in-corona-sdk/ that may help you. [import]uid: 14218 topic_id: 34385 reply_id: 136681[/import]

Thank You very much I did it.

Now I need a swipe gesture, i.e. when player swipe to right the object should move from left side to center if swipe it again it goes to right side.

I’m trying to make a swipe gesture but I can’t find the right way, any help??? [import]uid: 197049 topic_id: 34385 reply_id: 136708[/import]

(Should be a new thread, but…) You want to check the positions received by the touch listener. Just check for the difference in the X values being more than the different in Y values. There are gestures libraries, but not many good ones, if you wanted to go the complex route. I think you just need to clearly think about how the maths would be considered and then apply the algebra to your code. [import]uid: 8271 topic_id: 34385 reply_id: 136753[/import]