View Single Post
  #1  
Old 02-04-2012, 07:09 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
New Movement System

Basically it will allow you to navigate around with only your mouse.
Only problem is I have no idea how to do proper wall checks and make the player slide if they walk diagonally following a wall, anyway here is my code so far.
PHP Code:
//#CLIENTSIDE
function onCreated(){
  
onTimeout();
}
function 
onTimeout(){
  
temp.deltax mousex player.x;
  
temp.deltay mousey player.y;
  
temp.angle getangle(deltaxdeltay);
  if(
leftmousebutton && !onwall(player.cos(angle)*0.6player.sin(angle)*0.6)){
    
player.+= cos(angle)*0.6;
    
player.-= sin(angle)*0.6;
    
player.dir getdir(mousex player.xmousey player.y);
    
setani("walk"null);
  }
  
settimer(0.05);
}
function 
onMouseUp(b){
  if(
== "left" && player.ani == "walk"){
    
setani("idle"null);
  }

Does anyone have any idea's for a good wall check system that could be incorporated with this?
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote