How do I make an object go up and down

  • Hey guys! I just wanted to let you know that I have read the tutorial for the platformer by Ashley. The thing about that tutorial is that it only shows how to go left and right. The thing I want to do is make it go up and down. I am making a puzzle/maze game. And on the 11th level I want there to be something that bounces off the walls at a decent speed to give the player a bit of a challenge.

    Here is what I had for my code keep in mind that "movement" is my instance variable.

    deathWallMove movement = "up">deathWallMove Simulate platform pressing Jump

    >deathWallMove set Not Mirrored.

    Also in the game the block goes down but will not bounce because the only options are left and right. My game is apparently too large to upload so I hope someone understands what I am trying to do.

    TL;DR Trying to make an object bounce up and down after hitting a wall

  • Just give your object the platform behavior.

  • GameThirsty I did that yes. And it just falls. That's it. Could you please explain how I can make it bounce?

  • Try this as an example to bounce

  • ,,,,,,,,,,,,,,,,,,,,,

  • GameThirsty Yeah that is kind of like what I want, let me explain better. I would like that object (ball in this case) to bounce off of the top wall and then go down to the bottom wall, and bounce off of that. Think of the flying koopas in Super Mario. They have a set thing where they will go down and up, but in my case id like it off of a wall.

  • GameThirsty korbaach Here is an example of what I mean. I'd like the green square to bounce off of these black squares so it just goes up and down up and down up and down

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here use the bullet behavior instead, and add two solid objects

  • GameThirsty You sir are a Godsend. Thank you so much dude. I really appreciate this. Is there anyway I can give you medals or reputation or something for your help? Thanks again for taking the time to help friend!

  • Glorpy I am not sure, haha. You're welcome for the help.

    Remember to set the angle of motion to 90 on the layout start because a default bullet behavior is 0 degrees which would be horizontal movement, you want 90 for vertical.

  • I basically have it right now as:

    deathWallMove on collision with Wall > deathWallMove Set bullet angle of motion to 90 degrees. Do you think there is a way to make it so on other walls it will bounce horizontally? Actually I could just make horizontal movement and vertical two different sprites/objects. Thanks again for the help!

  • or just set the angle of motion to 0 on ones you want to go horizontal walls

  • GameThirsty Hey man one more thing, sorry. I find the more I let the level run the objects will start all going up and down instead of back and fourth...hm

  • Which ones? the ones that you set the angle to 0 or 90

  • GameThirsty The ones that are at the 90. If you leave the game going for like 30 seconds they start lining up. I'll show an example in text

    What they should be doing 30 seconds after the layout begins: ^ v ^ v AFTER BOUNCING OFF WALL: v ^ v ^

    What it is doing 30 seconds after: ^^^^ AFTER BOUNCING OFF WALL: vvvv or pretty dang close

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