View Single Post
  #2  
Old 01-04-2014, 04:34 PM
Starfire2001 Starfire2001 is offline
Unholy Nation
Starfire2001's Avatar
Join Date: Dec 2010
Location: The streets.
Posts: 156
Starfire2001 will become famous soon enough
You need continuously to check the players position in a loop to see if they are within the bounds of the block. If you are looking to do it clientside...

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
setImg("block.png");
  
onTimeout();  // probably better than setting a timer here as you might not want to wait a second before checking
}

function 
onTimeout() {
  
// assuming that your block's dimensions are 2x2
  
if (player.x in |this.xthis.2| && player.y in |this.ythis.2|) {
    
//destroy or hide the block or whatever you want to do
  
} else {
    
setTimer(.05); // or higher if it doesn't need to be so accurate
  
}

If you want to do it serverside you'll have to loop through the players array in your timeout and check if any of them are within the bounds of the block.
__________________
-Ph8
Reply With Quote