Thread: Blocking Water
View Single Post
  #4  
Old 08-09-2011, 01:55 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
You could use a timeout to check if water is ahead of the player by using vecx and vecy:

PHP Code:
if( onWater( (player.x+1) + (vecx(player.dir)*3) ) ||
    
onWater( (player.y+1.5) + (vecy(player.dir)*3) ) ){ 
And then maybe cancelling out the movement with a backwards movement generated by the timeout:

PHP Code:
player.-= vecx(player.dir);
player.-= vecy(player.dir); 
I don't know what the player's walking speed will be, so you might have to find out how much backward movement you'll need to bring the player to a stop.
This is how I would have done it if I didn't have my own custom movement system.
__________________

Intelligence without ambition is like a bird without wings.


Last edited by iBeatz; 08-09-2011 at 01:57 PM.. Reason: Script error
Reply With Quote