Page 1 of 1
Some Help With Checkpoints
Posted:
Sun Dec 02, 2012 9:15 pm
by happyjustbecause
Hello everyone, after releasing my video on Night Knight I noticed an issue with the checkpoints, it's only on appearance but it has the chance of confusing the player and it's just sloppy.
So when a checkpoint is activated it changes the animation from having no signal flashing to having signals flashing. My problem is that I never deactivate the appearance of checkpoints even though that's not where the character will respawn. So is there anyway to change the animation of all clones of an actor except the collide actor. Upon collision with the antenna I need to change the animation of the old checkpoint (deactivated animation) and change the animation of the collide actor (activated animation).
Is there anyway to do this without having to specify what clone you're colliding with and saying getclone(Antenna.0)->animindex=0; getclone(Antenna.1)->animindex=0; etc.
Hopefully my point is understood with this, I would highly appreciate some help with this problem.
Re: Some Help With Checkpoints
Posted:
Sun Dec 02, 2012 9:23 pm
by skydereign
Most gE built in functions can target all clones, so you don't need to loop through them. As you know SendActivationEvent doesn't do this, which is why the pause system was a little troublesome. But, specifying just the actor name should effect all clones.
- Code: Select all
ChangeAnimation("checkpoint", "off", FORWARD);
Re: Some Help With Checkpoints
Posted:
Mon Dec 03, 2012 5:12 am
by happyjustbecause
Well just adding that kind of poses a problem with it. Maybe I didn't add the code in the way you're thinking it should be added but here is the code I'm using:
Night Knight -> Collision (Any side of Antenna) Repeat: No
- Code: Select all
check_x=collide.x;
check_y=collide.y;
ChangeAnimation("Antenna", "AntennaOff", FORWARD);
switch(collide.state)
{
case 0:
ChangeAnimation("Collide Actor", "AntennaOn", FORWARD);
PlaySound2...
collide.state=1;
break;
}
So what that code does is it will turn on the antenna but then if I run over it again, it will turn it off. And once it has been turned off, it won't be turned back on (animations wise, functioning as a checkpoint is still perfect). I need to make only the checkpoint that you will respawn at the one with the On animation.
Re: Some Help With Checkpoints
Posted:
Mon Dec 03, 2012 6:08 am
by skydereign
The problem is you aren't resetting the state variable. Because you can use the built in ChangeAnimation method to change all of the switches, you should use animindex instead of state. Works the same way, but without any reference to state.
Re: Some Help With Checkpoints
Posted:
Mon Dec 03, 2012 10:27 pm
by happyjustbecause
Oh yeah... That's why. I'm not sure why I even made it a switch of state anyways. Now I added that and it works as it should. Thank you very much.
Re: Some Help With Checkpoints
Posted:
Sun Dec 09, 2012 6:06 pm
by happyjustbecause
Ohhh... Actually I found out why I was using state for this code, because I didn't want the sound effect playing when colliding with an activated antenna. Now no matter if the antenna is on or off, the sound effect will play either way. How can I prevent this from happening?
Re: Some Help With Checkpoints
Posted:
Sun Dec 09, 2012 9:00 pm
by skydereign
You don't need the state variable, because you have the animindex variable which should act just like the state variable. So put the switch statement like you had, and it should work the same way.
Re: Some Help With Checkpoints
Posted:
Mon Dec 10, 2012 4:04 am
by happyjustbecause
Well for some reason this code isn't working (it won't switch the animation)
- Code: Select all
check_x=collide.x;
check_y=collide.y;
collide.animindex=0
switch(collide.animindex)
{
case 0:
PlaySound2...
collide.animindex=1;
break;
}
The animation isn't switching for some reason. I've had trouble with switching animindex before. I could just try making state=animindex? But switching animindex should work right?
Re: Some Help With Checkpoints
Posted:
Mon Dec 10, 2012 4:48 am
by skydereign
happyjustbecause wrote:The animation isn't switching for some reason
animindex is a read only variable, so you can't change it like that. You have to use ChangeAnimation instead. But by using it, you are changing the animindex.
Re: Some Help With Checkpoints
Posted:
Mon Dec 10, 2012 5:03 pm
by happyjustbecause
But using this code will produce the problem with the sound effect. I think it's because of the resetting, how can I reset it and prevent the sound effect from playing every time? Because I've tried like every combination of animindex and ChangeAnimation.
- Code: Select all
check_x=collide.x;
check_y=collide.y;
ChangeAnimation("Antenna", "AntennaOff", FORWARD);
switch(collide.animindex)
{
case 0:
ChangeAnimation("Collide Actor", "AntennaOn", FORWARD);
PlaySound2...
break;
}
Re: Some Help With Checkpoints
Posted:
Mon Dec 10, 2012 7:24 pm
by skydereign
That is because you turn every antenna off (setting animindex to 0) whenever you collide with a single antenna. If you want to do that, then you should put the ChangeAnimation into the case statement.
Re: Some Help With Checkpoints
Posted:
Mon Dec 10, 2012 8:56 pm
by happyjustbecause
Ohhhh... okay thank you again.
Re: Some Help With Checkpoints
Posted:
Tue Dec 11, 2012 2:47 am
by happyjustbecause
Sigh... Actually I don't know why I didn't fully test this, but the code now fixed the sound effect but it goes back to my original problem of having multiple checkpoints with activated animations. The code I'm using is this:
- Code: Select all
check_x=collide.x;
check_y=collide.y;
switch(collide.animindex)
{
case 0:
ChangeAnimation("Collide Actor", "AntennaOff", FORWARD);
ChangeAnimation("Collide Actor", "AntennaOn", FORWARD);
PlaySound2...
break;
}
That's what I interpreted from you saying:
If you want to do that, then you should put the ChangeAnimation into the case statement.
But I don't think that's what you meant... But I wasn't sure where I else I could really put the ChangeAnimation.
Re: Some Help With Checkpoints
Posted:
Tue Dec 11, 2012 3:03 am
by skydereign
Here is the code you had, I've commented a few things.
- Code: Select all
check_x=collide.x;
check_y=collide.y;
ChangeAnimation("Antenna", "AntennaOff", FORWARD); // this changes all antenna actors off
switch(collide.animindex) // this gets the animindex of the antenna you are colliding with
{
case 0: // but this is always 0, because line 3 sets all antenna off
ChangeAnimation("Collide Actor", "AntennaOn", FORWARD);
PlaySound2... // therefore the sound always plays
break;
}
What you really want though is to only trigger the code when animindex is actually 0.
- Code: Select all
check_x=collide.x;
check_y=collide.y;
switch(collide.animindex)
{
case 0:
ChangeAnimation("Antenna", "AntennaOff", FORWARD); // this changes all of them to off
ChangeAnimation("Collide Actor", "AntennaOn", FORWARD); // this changes the colliding one on
PlaySound2...
break;
}
Re: Some Help With Checkpoints
Posted:
Tue Dec 11, 2012 3:09 am
by happyjustbecause
Oh.... I didn't see that I didn't make the first ChangeAnimation set to the actor name rather than collide actor. I really need to pay more attention to things like that, because they make all the difference... Alright thank you for having such patience with me. I'll add those comments to my code just so I can remember what exactly it does.