Thread: Simple Movement
View Single Post
  #1  
Old 10-06-2007, 08:08 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Simple Movement

Here is a good way to move your object in all directions very easily.

PHP Code:
//#CLIENTSIDE  // Makes events all processed on the client comp

function onCreated()  //Action is called when script is read
{

  
disAbleDefMovement();  //Disables Default movement for player
}

function 
onKeyPressedcodechar)  //Called when ever the client pushes a key on the keyboard
{

  
code;  //make k equal the code number of what ever key is pushed

  
player.+= (( == 39) - ( == 37))/16;  //  if k equals number, it is 1, if not it is 0

  //so if the player pushes left arrow it be player.x += 0 - 1;  

  
player.+= (( == 40) - ( == 38))/16;  //same as above just on the y-axis


__________________
Deep into the Darkness peering...
Reply With Quote