How do I make a spirte move up and down in a loop

0 favourites
  • 13 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies. For use in game and custom works.
  • I thought I had this figured out. Same code made it go up. Then I added code to go down then it went up at a curve. Now it's going to a right.

    Real simple: How to make a Sprite move up and down? It goes up, stops, goes down, on a loop. Up, down, repeat, up down, repeat. I tried 8-direction and jumping and nothing is working. Simulate up keeps upping it even though I say Stahp in the code, and tell it to reverse direction and go down.

    Telling it to reverse direction or simulate DOwn makes it go LEft....

    Please help. A sprite going up, then down, repeating.

  • Phoenixbowman Easy one, just add the "sine behavior" and play a little with the propeties to achive it

  • That's beautiful, thank you works perfectly. I did reverse sawtooth and sawtooth but no way of making it start going up? When sine starts it starts going down first, then goes up. How to make it go up first, instead of down first?

  • Set propertie Period Offset to Period/4. So if period is 4, set Offset to 1.

  • It jump stutters down then goes back up. Starting from its base position on the layout, how to make it go up then down? setting the offest period makes it jump quickly down then go back up.

  • It works perfectly otherwise. Say the Sprite's starting X,Y position on the layout is 200, 200. With the way is now, the sprite goes down first before going up How to have it with the Sine behavior so the sprite starts at 200, 200 goes up first, then goes down, etc?

  • May I please have the code instead of a downloadable file? I'd rather not download stuff like that to my computer.

  • No can do, because that also implicates that you will not/can not download the required plugin LiteTween.

    How did Construct 2 arrive on your computer ?

  • The Sine functions works perfectly on its own. the only difference is to get the sprites to move up first, then down, instead of down first, then up.

    The Sine function works fine when it comes to moving up and down. Is a plugin absolutely necessary to reverse the order of how it moves? From down, up to up, down?

  • The sine behavior moves an object arround its initial state. There are 2 offsets where it is on exactly its intitial state. Since you dont want it to jump.

    Zero & Period/2

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can't a negative value in the magnitude setting work?

  • Hey,

    I am not an expert. However while learning construct 2 i have made a sprite go around a screen following some certain instructions. I have been helped on this forum a lot, so here is my best shot to help you out in turn.

    0. Set window size: 800, 480, layout size must equal window size.

    1. Give your sprite a bullet behaviour (bullet properties: "set angle" set to "yes", speed:100) and give it an instance variable, set an instance variable called "side" to 0.

    2. Follow the events here:

    As a result a sprite should go around your window size. Play with it and you should be able to make it go up and down if this is what you want.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)