Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Map 'tiles' in games
#1
I had asked earlier about MAP$ in some syntax i saw...
It turns out to be a function, in the function it determines (Oh, yes, it is a -like game) whether the block that you are standing next to, or trying to move to, has the ability to be blown up (temporary), if anything can be done to it (permanent), or there is no block there whatsoever. The od that he used was a two-dimensional array that had P for permanent, where the permanent tiles were on the map, R for blocks that could be blown up, and a 0 for no block whatsoever. I was wondering if this is a safe way to do a 'Map Check' or if there is a better and safer way. Oh, and in this case, for each component of the array there is a corresponding 'tile' on the map.

Should I use a function such as the one mentioned previously or try a new one?
isconception and deceit is the only way...

'An enemy of my enemy is my friend...'

'The only way to truly know a man, is to fight him...'
--The Matrix Reloaded--
Reply
#2
Quote:Should I use a function such as the one mentioned previously or try a new one?

It depends on what you're doing... and your programming style. I'd do it with a user-defined type and an array:
Code:
TYPE tiletype
  Image AS INTEGER
  Attributes AS INTEGER
END TYPE

DIM Tiles(0 TO 31, 0 TO 31) AS tiletype

Say if the attribute is 0 then you can walk there, and if its 1 then you can't. So if you're player has two location variables, plrX and plrY, and attempts to move north, you can check that tile with

IF Tiles(plrX, plrY - 1).Attributes = 0 THEN plrY = plrY - 1


Something like that, anyways.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)