| 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(deltax, deltay); if(leftmousebutton && !onwall(player.x + cos(angle)*0.6, player.y - sin(angle)*0.6)){ player.x += cos(angle)*0.6; player.y -= sin(angle)*0.6; player.dir = getdir(mousex - player.x, mousey - player.y); setani("walk", null); } settimer(0.05); } function onMouseUp(b){ if(b == "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?
|