The Daily Click ::. Forums ::. Klik Coding Help ::. Beat-em-ep AI
 

Post Reply  Post Oekaki 
 

Posted By Message

Werbad



Registered
  18/09/2002
Points
  235
12th August, 2006 at 07:17:48 -

You have no life....

 
n/a

deadeye



Registered
  22/07/2006
Points
  73
12th August, 2006 at 13:08:34 -

Matt Gardner...

Check out one of the many tutorials on "spread values." Do a search here, and on the clickteam boards. You will find the answers you seek. I had this same question just last week when my enemies had messed up gravity. When one enemy would land, all the other enemies that were falling would stop in midair because when one enemy's falling flag needed to be turned off, MMF was turning off all of them.

You'll need the fastloop object for this. Basically, you need to make a loop for each type of enemy. The loop will run once for every enemy. To distinguish each enemy as an individual, you need to index each with a unique number. This is where spread values come in. Basically, it breaks down like this:

Let's say you have an enemy named Bob. There are three Bobs on the screen, and each should have it's own action, animation, life guage, etc.

1. Make a counter called "bobCounter." This will keep track of the current Bob that the loop is working on. Before the beginning of every loop, set it to ZERO.
2. Name an Alterable Value in your enemy properties to "spread" or "index" or something like that, so you can keep track of what Alt Value it is easily. This is where you will store each enemy's unique identifying number.
3. Start your fastloop like so:

* Always
- Start Loop #1 for NObjects("Bob") loop(s)

This will run your loop once for every instance of "Bob" in your frame. Loop #1 is just an example, you can use whatever number.

4. At the beginning of every loop, use this command:

* Fast Loop object: Loop Trigger #1
- Spread value 0 into Alterable Value "index" of Bob

You can find the Spread Value command under the Alterable Values section. Anyway, when you tell MMF to "Spread value 0," what it's doing is assigning a number to each Bob in the order that it was created, starting with zero. So now each of your Bobs has a different number in it's Alt Value "index." They're now labeled 0, 1 and 2. If you change the command to another number, like "Spread value 2," it will number each of your Bobs starting with 2 so you'd have Bobs 2, 3 and 4. Hope that doesn't confuse you. Let's just stick with "Spread value 0."

5. Now, whenever you perform any action or change any data in one of your Bobs, you need to tell MMF specifically which Bob it's working on. That's where the counter comes in. Since you set it to zero before the loop began, it will start working on Bob 0 first, and only Bob 0, as long as you do this:

* Fast Loop object: Loop Trigger #1
* Alt Value "index" of Bob = value(bobCounter)
- (check for collisions, scan for an opening, punch, move, change animation, yaddayadda whatever)

Now when you tell Bob to change animation, the only Bob changing animation is the Bob who's index number matches the current number in the bobCounter. Which brings us to

6. At the end of your loop, add 1 to bobCounter. Then the loop starts over, and begins work on the next Bob. That's it.

Hope this helps, and that I wasn't too confusing. Just search for those tuts and check them out. Good luck...

Image Edited by the Author.

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
12th August, 2006 at 13:18:59 -

Yeeeeaaahhhh; you see all that stuff he posted. It's good stuff; a bit off (You don't need to spread the value in a loop); but good stuff.

Anyway, mine does the same thing in a messed up way.

 
Craps, I'm an old man!

deadeye



Registered
  22/07/2006
Points
  73
12th August, 2006 at 16:00:17 -

I was wondering that, actually. It didn't seem necessary to do the spread value command inside of the loop, but one of the tutorials I read had it set up that way. Oh well, it doesn't make much difference, I guess.

 
n/a

Matt Gardner



Registered
  07/10/2002
Points
  14
12th August, 2006 at 18:45:16 -

I actually just discovered that each object is assigned a unique number as 'fixed value'

I can have each graphic for the enemy be assigned to have Alt Val A = the fixed value of the enemy.

Then when I have it change animations it only does it to the graphic with the Val A that matches the enemy's fixed value. So that's taken care of.

Now to just work on the movement. I think I'm going to start from scratch with that, what I've got now is getting too complicated.

 
It's Gravy!

Nova Soft



Registered
  16/10/2005
Points
  427
13th August, 2006 at 02:19:56 -



Image Edited by the Author.

 
By a route obscure and lonely,
Haunted by ill angels only,
Where an Eidolon, named night,
On a black throne reigns upright,
I have reached these lands but newly
From an ultimate dim Thule
From a wild clime that lieth, sublime,
Out of space
Out of time.
   

Post Reply



 



Advertisement

Worth A Click