The E is the enemy. The "circle" around him is ment to be his range so if you step into it you get shot at. I did this with active objs. (big circles) but this is stupid and it acts like a patriot missle in C&C: Generals- all enemies shoot at you regardless of where they are. I also tried it with X and Y positions to determine where you are compared to the enemy. But for some reason only one enemy had a range square and all the other ones just sat there like dumb shitheads. Fuckers.
Any help please? I'm getting quite literally angry here.
I have the ENTIRE C&C: Tiberian Dawn soundtrack. Extracted from the original game, in all it's succulent beauty. Oh baby, it's true. PM me for details on how to get it if you want.
Hmmm, this is a pretty shit idea that works sometimes:
Have the enemies constantly shooting out little sensors in 32 directions that get destroyed by walls and stuff. You can limit their range by detroying them based on alterable values and you could also use random numbers in order to associate them with one particular enemy.
What my new game uses is an invisible active picture square that is set to always follow the main character around like so:
x--------
| |
| O |
| |
---------
Where the "o" is the guy, and it's set to like -50,-50 from the guy's position. When the enemy is "struck" by this invisible box, it activates its movement / flags / etc and you're all set.
You could realistically use similar boxes around each enemy, only make them different sizes depending on what their vision or line of sight rating would be. Then, when the player collides with one, it can shoot at him.
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
My example sets a rule that for an enemy to 'see' you, it must:
a. Be visible on-screen, and...
b. Have a clear line of sight between it and you.
On every check of the events, it resets the ID of all the enemy objects to 0. Then it spreads a value only through the ones that are currently within -32px of the window's edge (that has the effect of making sure that the enemies are on-screen).
It then loops through each of these visible enemies and uses MoveSafely2 object to shoot a tracer from the player to each of the enemies. If the tracer passes through a wall, a flag is set ON. When the tracer finally hits its target, that flag is checked. If the flag is OFF, then there were no obstacles between the player and the enemy. That enemy is then set to 'Alert' mode.
This way it only loops through enemies that are in range, and only selects those ones that have a clear line of sight.
The engine could be adjusted very easily to only select enemies that are within X pixels of the player, instead of the on-screen ones.
It still has some tweaking to be done, but I may upload it later.