In your "always" loop, you should only change the animation if it's necessary, so
if (Fired? == True and Animation For Self != Fired) {
Switch animation to Fired for self;
}
if (Fired? = False and Animation For Self != Idle) {
Switch animation to Idle for self;
}
It's actually working how I have it now. The cannon is in idle, and when it fires it switches to it's fired animation, and then after 1 second (I changed it to 0.25), it switches back to idle.
Oh, it'll work the way you've got it, but changing an animation every frame when it isn't necessary is wasteful. A simple "if" check takes basically no time at all, whereas the mchanics of switching the animation probably has a more significant overhead. I'm not sure how Stencyl/Flixel handles that under the hood, but it's certain to be more costly than an "if" statement.
In the pressure plate behavior, you are using "self" in the "get" blocks. So, you are getting _UniqueID and _IsActive from the Actor the behavior is attached to, which I assume is a pressure plate. You need to use "Actor of Type" where you have Self. That way, as you cycle through all the Actors of type "Down Cannon," you are checking the current Down Cannon for the values.
Sorry, I don't fully understand. I didn't realize I could drag the "Actor of Type" thingy down and into the "get" blocks. Is that what I'm supposed to do? XD
Yes, that's correct. The Actor in the "Self" box is the Actor that block is talking to. If you leave it on Self, it is talking to the Actor the behavior is attached to. If you drag a reference to another Actor into there, the block will talk to that Actor, instead of to Self.
You never use the Cannon List, instead you are checking "_UniqueID" against the value "Yes." Let me explain Cannon List.
Cannon list should be a list, with values like this:
0
2
3
5
Then, you check each Down Cannon's _UniqueID against each item in Cannon List. That way, one pressure plate can control multiple Down Cannons. So, your loop should look like this:
For each Actor of Type Down Cannon {
For each item in Cannon List {
If (for [actor of type], get [_UniqueID] from behavior [Cannon Fire] == item from Cannon List) {
Do stuff;
}
}
}
Again, sorry. This is the first time I've ever used a list so I don't fully understand. For "item from Cannon List", do I just type in the number or text in the list that I'm looking for, or is there a block I need to pull out? In the list I added values "Yes" and "No" and then in the Unique ID's for the cannons I wanted the plate to control I put in Yes, and for the ones I don't want it to control I put in No.
If you're only going to have two options - Yes and No - you don't need the list at all, you just check "if Unique ID == Yes." The point of the Cannon List is to let each pressure plate control an arbitrary number of Down Cannons.
Pretend you have four Down Cannons and two pressure plates. The Down Cannons have these Unique IDs:
Down Cannon 1 = 0
Down Cannon 2 = 1
Down Cannon 3 = 2
Down Cannon 4 = 3
Pressure Plate 1 has a Cannon list of:
0
2
Pressure Plate 2 has a Cannon List of:
1
3
Now, each Pressure Plate does this:
For each Down Cannon in the scene {
For each item in Cannon List {
If (Unique ID of Down Cannon == item from Cannon List) {
Turn off current Down Cannon;
}
}
So, each Pressure Plate goes through each Down Cannon in the Scene, checking to see if that Down Cannon's Unique ID is in its Cannon List. If it is, it turns off that Down Cannon. To make this comparison, you check the Down Cannon's Unique ID against each item in the Cannon List.
If (Unique ID == current item from Cannon List) { }