Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   New Movement System (https://forums.graalonline.com/forums/showthread.php?t=134265690)

Gunderak 02-04-2012 07:09 AM

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?

callimuc 02-04-2012 07:35 AM

Quote:

Originally Posted by Gunderak (Post 1683587)
Does anyone have any idea's for a good wall check system that could be incorporated with this?

This one seemd to be the easiest at least in the code gallery. Might be helpfull
http://forums.graalonline.com/forums...ad.php?t=78043

Gunderak 02-04-2012 10:39 AM

Thanks for the link, I'll check it out when I'm home.


All times are GMT +2. The time now is 01:52 PM.

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