Simple Run Script(Sphere)

Booda Sack

Sphere Master
  • 300
    Posts
    20
    Years
    I'll work on more in depth tut's but for the moment,here is a simple but very effective script.

    Code:
    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.
     
    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!!!
     
    Back
    Top