The Daily Click ::. Forums ::. Klik Coding Help ::. distinguishing between enemies?
 

Post Reply  Post Oekaki 
 

Posted By Message

gene arvan



Registered
  25/06/2005
Points
  7
3rd July, 2005 at 01:13:10 -

if I have a bunch of enemies.. all instances of the same active object.. so how do i diferrentiate between them if i want only one of them to do something. i can understand its easy to do for just one action.. but what if i have different groups for diff ai 'states', and i want one of them to start doing an 'attack' state while the others remain idle.

thanks =

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
3rd July, 2005 at 02:46:27 -

Each active has it's own Unique identifier called its Fixed Value. However that isn't very helpful if you want to check each object to see if it's doing something. What you want to do is use a loop to scan through each object.

Here's what I searched for:
http://www.create-games.com/cs_search.asp?q=fastloop&sar=on&sfo=on

And a good article on the subject:
http://www.create-games.com/article.asp?id=106

Goodluck.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

defenestrator

Old

Registered
  12/07/2003
Points
  724
3rd July, 2005 at 12:41:20 -

You can use alterable values for things like this. How you'd set it up depends on what you want the enemies to do, but say you have ten enemies. At the start of the frame, you set the enemies' Alterable Value A to random(3). This will set each enemy's Alterable Value A to either 0, 1, or 2. Then you can set separate actions to have enemies shoot if their Alterable Value A is 0, move if it's 1, and eat ice cream if it's 2. Whatever you want. Hope that's helpful.

 
n/a

gene arvan



Registered
  25/06/2005
Points
  7
3rd July, 2005 at 15:06:56 -

hmm thanks for the advice but it really doesnt solve my problem.. maybe i need to elaborate:

im making a beat-em up and i need some of the enamies to wait their while others are attacking. then when the attacker dies i need another enemy to run in and take his place,

anyone know how to create this illusion?

 
n/a

-Vinny-



Registered
  12/01/2005
Points
  436
4th July, 2005 at 15:16:11 -

you can do exactly what defenstrator(damn confusing spelling) said, if the alterable value = 0, make the enemies move towards player, when one enemiy gets close enough to the player, set their alterable value to 1 and attak player, then do a check, and if one of the enemies has an alterable value of 1, set the alterable value of the other enemiess to 3, and when the attacking enemy dies, set the alterable values of the other enemies to 0 to restart the process

here's the process

0 = move towards player
1 = attack player, set enemies with alterable value 0 to 3
3 = stop moving

scan for an alterable value of 1, if alterable value of 1 is apparent, then set all enemies with an alterable value of 0 to 3

when attacking enemy dies, set all enemies with alterable value 3 to 0

and just use the article to learn how to scan through your enemies for their alterable values

Image Edited by the Author.

 
Vinny
   

Post Reply



 



Advertisement

Worth A Click