Page 1 of 1

How would I go about replicating these common Mario things?

PostPosted: 14 Feb 2018, 20:08
by darkhog
1. Working warp pipes. There are pipe graphics in the game, so graphic part is solved, but how would I go about the code? Possibly script, but what (sorry for stupid noob question like this, but I was unable to find ST script API reference)

2. Climbable area rising from a block (think Super Mario vines)

3. Moving parts of levels that aren't enemies (think SMB3/SMW castle areas).

Re: How would I go about replicating these common Mario thin

PostPosted: 15 Feb 2018, 09:45
by manuel
Scripting reference: http://supertux.lethargik.org/wiki/Scripting_reference

1. There are no working warp pipes in the game, as SuperTux isn't intended to be a SuperMario clone. But you can help out with a script:
Just place a script trigger above a pipe and check the "Button" checkbox. Then the script will only be activated when pressing the ACTION key. Additionally, you can place the pipe in the foreground (at least layer 51) and place a moving platform behind it (Running must be unchecked). The second platform node should be at least two blocks below the pipe surface so it seems like Tux dives into the pipe.
Then use this script:

{l Code}: {l Select All Code}
Tux.deactivate();
<Platformname>.goto_node(1);
wait(<The time the Platform goes to the second node>);
Tux.activate();
Level.spawn("setorname","spawnpointname");

You need a script which makes the platform go up again, too. If Tux will stay in the same sector, you simply can add a <Platformname>.goto_node(0); at the end of your script. But I'm not sure if it will work when Tux changes the sector as you cannot activate something in a different sector.

2. Climbable raising blocks cannot be made as an object allows Tux to climb, but you cannot move objects (for the same reason you won't be able to move coin blocks with a moving tilemap).

3. If this is the same question you asked here: https://forum.freegamedev.net/viewtopic.php?f=69&t=7814, then you will find the answer there.

Re: How would I go about replicating these common Mario thin

PostPosted: 15 Feb 2018, 09:55
by manuel
Hope, you understand 1.
If not, just ask and I will add a screenshot gallery to this post.

Re: How would I go about replicating these common Mario thin

PostPosted: 15 Feb 2018, 17:24
by darkhog
Oh I understand perfectly. Also I think I could reset "pipe platforms" in a sector init script (if it's done once sector is entered). Anyway, isn't it possible to scan keyboard and check for what key you press while in a script object (perhaps in a loop? IDK) I'd really like to have downward pipes to respond to the down key instead of action button (which as I understand it is either up key or fire key).

Re: How would I go about replicating these common Mario thin

PostPosted: 15 Feb 2018, 17:37
by manuel
I don't know whether Squirrel or SuperTux offer the possibility to check for a pressed key that easy. But I think the action key is good enough, especially because the player learns to use it for switches.

Re: How would I go about replicating these common Mario thin

PostPosted: 15 Feb 2018, 18:54
by mteufel
I don't think that is possible either. And support not planned either. But we might add some kind of pipe-thingy natively anyway. There was the idea of filling them with water and having Tux swim through -- as soon as swimming works.