How do I make something like a trampoline?

0 favourites
  • 8 posts
  • Sorry if this has been posted before, but I am new to this software and forum. I'm looking to create a game where the character is on a trampoline and has to jump on it to go higher. so essentially what I need is something that increases the height of the character every time the he hits the trampoline. Thanks in advance and sorry if that isn't clear.

  • To do this you're going to need to work with variables; I knocked up this little example (By using a platformer example from someone else that I happened to have open at the time, I'm very lazy and full credit for everything above my little comment on the event sheet to the original author!)

    See here: sendspace.com/file/55neie

    Basically I set a variable that tells the game what to set as the value for a Set Y Vector event, which gives you the bounce upwards effect (When you specify a negative value).

    This variable is increased by with the function *1.2 every time the player hits the trampoline, so each jump will be a bit higher.

    The next important thing is to reset the variable when the player touches the ground, this is easy to do with a set value event for our bounce variable.

    And that's pretty much it, one event to handle your bounce height and your set: to make it better you can specify a ceiling(A numerical upper limit) for your bounce height by giving the trampoline event the condition that your bounce variable must be less than a certain number to continue growing in size.

    Hope I've helped, any questions please ask! :)

  • Thank you, that is exactly what i needed. I will look through it later.

  • if you don't want the player to jump higher each time, you can simply

    slap a platform behavior on the player and then....

    on player collides with trampoline -> simulate control jump

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For some reason I did what you did and my avatar is jumping but he isn't getting any higher just keeps jumping to the same height.

  • Let's see the .capx (Y)

  • I don't know what happened last time, but I restarted and it's working. However, how can I set a max height that the character will go?

  • Yep sure thing, I don't have much time so I'm just going to dump the very hackish solution that works, sorry I don't have time to explain but hopefully the event sheet explains it!

    <img src="http://i.imgur.com/Knqmpbs.png1" border="0" />

    As well as an event that resets the tramp bounce variable when the platform object is "onLanded".

    If you have any questions please ask :)

    There's definitely a better way of doing this but my head's not in it...

    Yann

    Any suggestions, I want to say an if/else statement would be more elegant.

    Gotta dash :D

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