An Object who move from top to bot & bot to top ?

Get help using Construct 2

Post » Sat Aug 29, 2015 9:56 am

Hello All,

I'd like to build a permanant movement from up to bot and bot to up for my sprite object

I have a sprite object and i'd like this :

Every Ticks:
If this Object <= to Y.position(0px):
Object move 1 pixel at angle 90 (going to bottom)
If this Object <= to Y.position(100px)
Object move 1 pixel at angle 270 (going to top)

Can you help me please ?

Best regards
B
6
S
1
Posts: 50
Reputation: 502

Post » Sat Aug 29, 2015 10:10 am

Lol, i found sorry.

My solution:

Code: Select all
Global Variable TriggerMyObject = 0
Every ticks call the function MyObjectFunction()

Function MyObjectFunction()
  SubEvent If TriggerMyObject = 0 : MyObject move 1 pixel at 90
     Sub-SubEvent MyObject Yposition > 100 : TriggerMyObject = 1
  SubEvent If TriggerMyObject = 1 : MyObject move 1 pixel at 270
     Sub-SubEvent MyObject Yposition < 0 : TriggerMyObject = 0
B
6
S
1
Posts: 50
Reputation: 502


Return to How do I....?

Who is online

Users browsing this forum: GrogIsGood, kainrazial and 4 guests