#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2007
    Posts
    114
    Rep Power
    28

    The best way to...


    Hey,

    I'm making an RPG and would like to know what the best way to change equipment and and alternate between "running and walking" and "sword in sleeve and sword out of sleeve" along with some other movments.

    This is what im thinking of right now - I have a model which is a basic animation of a man walking and when the key R is pressed a new model will load with a new animation of the man running. And the same priniples apply to other movements.

    Like this -
    Controls -

    R = Run
    W= Walk
    A = Arm (draw sword)
    D = Dis Arm

    Code:
    KeyboardState keys = Keyboard.GetState();
    if (keys.IsKeyDown(Keys.R))
    
     myModel = content.Load<Model>( "Run" );
    }
    elseif { 
    (keys.IsKeyDown(Keys.W))
    
     myModel = content.Load<Model>( "Walk" );
    }
    
    elseif {
    (keys.IsKeyDown(Keys.A))
    
     myModel = content.Load<Model>( "Arm" );
    }
    
    else {
    (keys.IsKeyDown(Keys.D))
    
     myModel = content.Load<Model>( "DisArm" );
    }
    Is this good, or is there a better way?
  2. #2
  3. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    Does it work? If so then ya it's fine , IMO the best way is to build most of it first then do refining after, as you build you'll find if something works well or not.

IMN logo majestic logo threadwatch logo seochat tools logo