How do I use functions to travel through Mario pipes

Get help using Construct 2

Post » Thu Oct 15, 2015 5:29 pm

Hey there, guys. I was just wondering if anybody had any advice on how to use functions to move through pipes in a Super Mario Bros. remake I'm doing. Right now, I just have to code each individual pipe to move me to another location. This is very inefficient, however, as I believe I could just use a function event one time and it work with every pipe. All the pipes just take me to one location, though. Please help, thank you
B
5
S
1
Posts: 5
Reputation: 285

Post » Thu Oct 15, 2015 7:00 pm

Give the pipe a variable and use the variable in the function to decide where to go..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Oct 16, 2015 6:33 am

The animation would always be the same, so that's what you want. And I would use the same pipe graphic, and pick by Unique ID in the code to decide where to go.

Like LittleStain said, use a function to run the animation process, then separately call for the UID to tell which layout/area to go to. This way, you don't always have to go to another layout (like Mario 3's higher/lower areas for verticle levels).

Bottom line, it takes quite a bit anyways, but you can shorten the code by giving similar things such as the animation procedure as always the same regardless of which one it is, but each one does have to find a method of knowing where to bring the player.

Below is how I do it for warping in my Zelda 2 clone. Because there are no animations, but I use the same "event" graphic, I have to pick by UID to determine which graphic is actually being activated.

Image
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Fri Oct 16, 2015 11:40 pm

wow, thank you so much for the quick response, it was very helpful :)
B
5
S
1
Posts: 5
Reputation: 285


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, farsen and 8 guests