-
game map borders
Hey, im trying to make a very simple explore rpg game like this one
http://www.kongregate.com/games/Atel.../micro-dungeon
so far i only made my character movement
i cant seem to make/find any efficient codes that will make my character unable to walk over walls
i have tryed a couple of simple things but it does not work that efficient
there is probably a very easy way to do it, but i cant find any online
any tips? thx in advance
-
Prid - Outing
Post the code you wrote for the movement
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Senior Member
So you have your map in [x][y] 'cells'. If going from one cell to the next, check if the 'to' cell has .isWall property.
Actionscript Code:
function Move(x:int, y:int):boolean{ if (cells[x][y].isWall) { //play thud //display message- derp you cant walk through that //etc. return true; }else{ //set current location to the 'to' cell. return false; } }
I dont think that gets any simpler and efficient than that. (generally speaking) call the above when the 'arrow is clicked' or when 'a key is pressed'. It all depends how you have your cells layed out (I recommend a multi-array like the above).
Hope that helps, post code for more help.
-GK>.-.<
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|