how do i make tux run?

how do i make tux run?

Postby sinisa3games » 16 Feb 2018, 10:47

how do i make tux run? (with a script)
Hi i am an 11 year old Serbian kid
User avatar
sinisa3games
 
Posts: 52
Joined: 08 Feb 2018, 20:45
Location: Right over there

Re: how do i make tux run?

Postby manuel » 16 Feb 2018, 10:58

I never did that, but here's what I would try following to the Scripting Reference (http://supertux.lethargik.org/wiki/ScriptingPlayer).

Tux.walk(speed) Maybe add a high speed to him.
Tux.do_scripting_controller("left",true) This should make Tux react like the "left"-key was pressed (You can use "right" if he should run in the other direction). But I don't know if this is only a short action and Tux will only make one step.
manuel
 
Posts: 85
Joined: 19 Sep 2017, 09:03

Re: how do i make tux run?

Postby sinisa3games » 16 Feb 2018, 11:03

i just needed to do tux.walk(high speed), anyways thank you
Hi i am an 11 year old Serbian kid
User avatar
sinisa3games
 
Posts: 52
Joined: 08 Feb 2018, 20:45
Location: Right over there

Re: how do i make tux run?

Postby manuel » 16 Feb 2018, 11:34

Ok, nice to hear. Then I've learned something, too :)
manuel
 
Posts: 85
Joined: 19 Sep 2017, 09:03

Re: how do i make tux run?

Postby mteufel » 16 Feb 2018, 12:03

{l Code}: {l Select All Code}
Tux.do_scripting_controller("left",true);

Would not work anyway. You first need to hand over control of key input to the script:
{l Code}: {l Select All Code}
Tux.use_scripting_controller(true);

When this is done, the player's keyboard input is disabled however (until you execute the same function but with false).
SuperTux developer
mteufel
 
Posts: 135
Joined: 03 Jan 2016, 09:27

Who is online

Users browsing this forum: No registered users and 1 guest