How do I make something like a trampoline?

Get help using Construct 2

Post » Tue Mar 26, 2013 8:51 pm

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.
B
3
Posts: 4
Reputation: 658

Post » Tue Mar 26, 2013 9:28 pm

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: http://www.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! :)
B
49
S
14
G
3
Posts: 540
Reputation: 5,611

Post » Tue Mar 26, 2013 9:42 pm

Thank you, that is exactly what i needed. I will look through it later.
B
3
Posts: 4
Reputation: 658

Post » Tue Mar 26, 2013 10:28 pm

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

B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Wed Mar 27, 2013 9:25 pm

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.
B
3
Posts: 4
Reputation: 658

Post » Wed Mar 27, 2013 11:22 pm

Let's see the .capx (Y)
B
49
S
14
G
3
Posts: 540
Reputation: 5,611

Post » Thu Mar 28, 2013 10:23 pm

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?
B
3
Posts: 4
Reputation: 658

Post » Thu Mar 28, 2013 11:05 pm

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!



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...

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

Gotta dash :DMr E Bear2013-03-28 23:07:33
B
49
S
14
G
3
Posts: 540
Reputation: 5,611


Return to How do I....?

Who is online

Users browsing this forum: Braus, Draconinho, Magistross, nedzad, R0J0hound and 28 guests