View Single Post
  #1  
Old 07-21-2001, 05:32 PM
Jerom Jerom is offline
Banned
Jerom's Avatar
Join Date: Mar 2001
Location: In a Trash Can
Posts: 3,708
Jerom is on a distinguished road
Send a message via AIM to Jerom
Unhappy Needs help with keydown

To start out this post...I suck at scripting!!!
I was making the starting movement for a race and I couldn't make it so that the player stops using walk.gani and uses idle.gani when the player isn't moving. Right now the player just moves all the time.
Here's the script, could you help me out(i added the onwall incase that may be of any good use)?:
if (playertouchsme) {
toweapons System;
disabledefmovement;
timeout=0.05;}
if (timeout) {
if (keydown(0)){
playerdir = 0;
playery-=0.5;
setani walkslow,;
}
if (keydown(1)){
playerdir = 1;
playerx-=0.5;
setani walkslow,;
}
if (keydown(2)){
playerdir = 2;
playery+=0.5;
setani walkslow,;
timeout=0.05;
}
if (keydown(3)){
playerdir = 3;
playerx+=0.5;
setani walkslow,;
}
timeout=0.05;
//left detection
if (onwall(playerx+0.5,playery+1.5)) {playerx+=0.5}
if (onwall(playerx+0.5,playery+2)){playerx+=0.5}

//right detection
if (onwall(playerx+2,playery+1.5)) {playerx-=0.5}
if (onwall(playerx+2,playery+2)) {playerx-=0.5}

//down detection
if (onwall(playerx+0.5,playery+2.5)) {playery-=0.5}
if (onwall(playerx+1,playery+2.5)) {playery-=0.5}
if (onwall(playerx+1.5,playery+2.5)) {playery-=0.5}

//up detection
if (onwall(playerx+0.5,playery+1)) {playery+=0.5}
if (onwall(playerx+1,playery+1)) {playery+=0.5}
if (onwall(playerx+1.5,playery+1)) {playery+=0.5}
Reply With Quote