Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-08-2011, 08:50 PM
blackbeltben blackbeltben is offline
Registered User
Join Date: Aug 2011
Posts: 83
blackbeltben is on a distinguished road
simple movement help.

Hi forums. I am trying to make a simple movement system where i can move left and right. and that's it.
Ill show what i have but can some one please modify because it seems buggy and the movement is not as instant as the default one. Also, if someone could add the tile detection so he can't walk though walls that'd be great.
Please explain also, as I am trying to take not and learn.


//#CLIENTSIDE
function onCreated()
{
canmove = 1;
disabledefmovement;
}

function onKeyPressed(temp.code, temp.key, temp.scan)
{
if (canmove = 1)
{
if (keydown(3))
{
player.x +=0.3;
player.dir = 3;
setAni("walk", NULL);
setTimer(0.3);
} else if (keydown(1)){
player.x -=0.3;
player.dir = 1;
setAni("walk", NULL);
setTimer(0.3);
}
}
}

function onTimeOut()
{
setAni("idle", NULL);
}
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.