PDA

View Full Version : Simple Run Script(Sphere)


Booda Sack
May 26th, 2005, 12:28 PM
I'll work on more in depth tut's but for the moment,here is a simple but very effective script.


BindKey (KEY_ALT, "OnRunKeyPressed()", "OnRunKeyReleased()");
var runsprite ="Hero.rss";
var walksprite="HeroRun.rss";
var running=false;

function OnRunKeyPressed()
{

SetPersonSpriteset("hero", LoadSpriteset(runsprite));

SetPersonSpeed("hero",2);
}

function OnRunKeyReleased() {

SetPersonSpriteset("hero", LoadSpriteset(walksprite));

SetPersonSpeed("hero", 1); // stop running
}



I'll go through it.
First line sets the Alt key as the run key.
Then are some variables declared so you can set the Run/Walk sprite

Then the function for when the runkey is pressed/released
If you have questions,ask.
If you want to know more about sphere's built in functions check out the "doc_functions.txt" that comes with sphere.

Peekimon
May 26th, 2005, 12:42 PM
Hm... this tutorial is very effective :) Although, I am not using Sphere, it may make good reference. It know 80% of it, 'cause, I know Java Script [web based], not the Sphere one, though. If I would rate it, I would give it a 10 out of 10 :)

OFF TOPIC:
1500 Posts!!!! YAYAYAYAY!!!

ashly138
May 26th, 2005, 04:16 PM
A schreenshots woud be nice :P

Booda Sack
May 27th, 2005, 05:09 AM
?
Why do you need a screenshot?

Neo-Dragon
May 27th, 2005, 09:10 AM
Thanks booda, handy. I'm trying to learn sphere, I'd like to make a game in it in the future.
oh, and maybe that guy would just like a screenshot to see it in action.