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

0 favourites
  • 2 posts
From the Asset Store
Best for runner games, sidescroller, arcade and more!
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Lol, i found sorry.

    My solution:

    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[/code:3ezgd8yu]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)