I put some little NPC guys walking back and forth in my game. However I can walk through them. How do I put a collision detection on so that they can't walk through me and vice-versa? However I don't want them to turn around because (leading to my next question) I'll want to be able to talk to them.
Also, how do you make it so that if you walk up to an NPC and press enter it will bring up a...
i see a reoccurring pattern here...
question1 - do the NPC's need to move?
if not, simply make the collision as a solid tile like your walls. If they move, you have to find the tiles it occupies, 4 at most, add the npc movieclip into the 2D map array at those positions. Remove the previous positions. Then when the player checks what cell its touching it will find that an npc/part of a ...
Ok, here's an swf. http://creativededication.com/hosti...0no%20title. swf (the forum said it was an invalid file type)
For talking to them, I guess even just coming in contact and causing the talking to appear would work. I could use a hittest for that once the npcs aren't walkable, right?
see here, i guessed that your tilesize was 32, which is that grid over your game.
image is pretty self explanatory.
now where the red cells are, there needs to be data in your map Array about what cells is there. Usually this is just the tile, grass tile. Tree tile etc.
But your NPC's need to be apart of this too. I guess the simplest fix is just find the one cell the NPC...
Newbie question: Should this be a function then? And if so, where should I call the function?
Tiles are actually 30x30 but that's irrelevant for the most part. I started with a tile-based because it's an rpg and I figured tile-based would be easier then doing 3-d maps and I have some previous experience (a couple years ago though so I don't know how much good it does) with tile-based games....
ok, if you dont know whether something should be a function or not and where it goes, i will tell you know, you will not be able to do this game. Posting up every single problem you encounter on Flashkit isn't good. People will catch on.
yes it needs to be a function and you can call it anywhere you want. Its your code, isn't it? you can do what you want.
And to quote myself - "please ...
mr_malee, I think your system assumes pure tile-based movement, ie where you move in a grid. In that case, I wouldn't check four tiles, I tend to free a tile as soon as a character is starting to leave it. That means you can move into the tile quicker, and you don't have to wait until the other character's movement is completed.
But this game seems to have a free movement system, so here I ...
nah, i'm simply using the grid as a method of storing data. The npc is added to the grid then the player find that "somewhere" in his cell there is an npc. So run a hitTest or something like that. Otherwise you need to run loops over all your npc's in the level and check them constanly. Which is another option and probably more feasible in this situation.
But i dont like it
nah, i'm simply using the grid as a method of storing data. The npc is added to the grid then the player find that "somewhere" in his cell there is an npc. So run a hitTest or something like that. Otherwise you need to run loops over all your npc's in the level and check them constanly. Which is another option and probably more feasible in this situation. But i dont like it
Newbie question: Should this be a function then? And if so, where should I call the function? Tiles are actually 30x30 but that's irrelevant for the most part. I started with a tile-based because it's an rpg and I figured tile-based would be easier then doing 3-d maps and I have some previous experience (a couple years ago though so I don't know how much good it does) with tile-based games. Plus I just love the old sprites on...
mr_malee, I think your system assumes pure tile-based movement, ie where you move in a grid. In that case, I wouldn't check four tiles, I tend to free a tile as soon as a character is starting to leave it. That means you can move into the tile quicker, and you don't have to wait until the other character's movement is completed. But this game seems to have a free movement system, so here I would use basically the same approach,...
Thread profile page for "[F5] NPCs in Tile Based Games" on http://www.flashkit.com.
This report page is a snippet summary view from a single thread "[F5] NPCs in Tile Based Games", located on the Message Board at http://www.flashkit.com.
This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity