Good god. COMMENT YOUR CODE.
Yeah... I think you may be on to something.
All I saw in that code was "tileToGo" and I thought of this.
Update. I've erased the whole tracking system and re-created it. I call it, Tracking System B2.
http://web.mac.com/avisaria/TrackingSystemB2.swfSo far I haven't set up blocks so the Npcs can walk on any tile, including the player's. As you can see in the video, the two human npcs on the plain grass map are set to movement style #2 and no aggression. Here's the movement chart:
Movement Style #1: Random movement
Movement Style #2: Target either player or another npc on the screen. If can't then move randomly.
Movement Style #3: Only target the player on the screen. If can't, move randomly.
The blobs and all 3 humans are set to #2. The blob is the only aggressive one. So in the video the two humans follow each other. Then when I go to the pond map, the blob targets the human and the human targets the blob. The blob is set to aggressive and kills the human then targets the player which it then attacks me. When I close and reopen the game, one human decides to set me as the target and the other human follows that human. Put in more humans and you can have a conga line.
Very easy to understand, very little code, and I can add more movement styles if needed. Now all I have to do is add in the proper blocks and such, then maybe up the smartness level to get npcs around barriers to their target.
Finished:
Tracking: Stalker Mode for Npcs to follow the Player and other NpcsFinished:
Battle: Npc Vs. Player and Npc Vs. NpcTodo:
- Event system: If this happens, then do that.
- Finish battle system: Put the movement restrictions back up and have the player able to attack when colliding with bad guy. Also make nice red text of damage hit appear when hitting each other.
- Make death routine so stuff happens when an npc or player reaches 0 hp.
- Make items/inventory. This is where I'm a bit iffy. Just 4 types of items? Potion, Weapon, Armor, and Trinket? Npcs can drop them? To pick up you step on it and a menu box appears asking to pick up? Can you only pick up weapons, armors, and trinkets that are more powerful than what you're currently wearing? Can you carry more than one of each? Can you sell any? What happens to your old armor if you pick a new armor?
- Talk routine. Pause gameplay, a transparent black bevelled edged box appears on screen with the npc's sprite in the top left corner with the Npc's name centered at the top with what he/she is saying right below that. Then below what they say, is options to choose conversations or click anywhere else and it stops talking/closes the talk window.
Answers to my questions, comments, questions of your own, hate mail?
-Gandolf
P.S. I also left room in the battle system for ranged attacks.