Thread: Tile Checking
View Single Post
  #2  
Old 07-22-2008, 04:50 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Well you can run a loop when the player enters a level like...

PHP Code:
function onPlayerenters() {
  for (
i=0;i<64*64;i++) { // check every tile in the level
    
if (tiles[i%64,int(i/64)] == watertilehex) { // this would have to be edited to check the current level, as on a gmap this would just check the top left corner
      
this.levelcontainswater true// yes, there's water in the level
      
break; // no need to check for more water, right? So let's stop checking!
    
}
  }

The problem with this is the fact that depending on the levels, you could be right next to water, but there will actually be no water in your current level(because of gmaps), so it could end up reading as false. So instead of checking the level, just check the tiles surrounding the player?

An even simpler method would just be using level.vars!
Reply With Quote