Some Help With Checkpoints

Non-platform specific questions.

Some Help With Checkpoints

Postby happyjustbecause » Sun Dec 02, 2012 9:15 pm

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.
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Some Help With Checkpoints

Postby skydereign » Sun Dec 02, 2012 9:23 pm

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);
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Some Help With Checkpoints

Postby happyjustbecause » Mon Dec 03, 2012 5:12 am

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.
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Some Help With Checkpoints

Postby skydereign » Mon Dec 03, 2012 6:08 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Some Help With Checkpoints

Postby happyjustbecause » Mon Dec 03, 2012 10:27 pm

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.
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Some Help With Checkpoints

Postby happyjustbecause » Sun Dec 09, 2012 6:06 pm

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?
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Some Help With Checkpoints

Postby skydereign » Sun Dec 09, 2012 9:00 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Some Help With Checkpoints

Postby happyjustbecause » Mon Dec 10, 2012 4:04 am

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?
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Some Help With Checkpoints

Postby skydereign » Mon Dec 10, 2012 4:48 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Some Help With Checkpoints

Postby happyjustbecause » Mon Dec 10, 2012 5:03 pm

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;
}
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Some Help With Checkpoints

Postby skydereign » Mon Dec 10, 2012 7:24 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Some Help With Checkpoints

Postby happyjustbecause » Mon Dec 10, 2012 8:56 pm

Ohhhh... okay thank you again.
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Some Help With Checkpoints

Postby happyjustbecause » Tue Dec 11, 2012 2:47 am

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.
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: Some Help With Checkpoints

Postby skydereign » Tue Dec 11, 2012 3:03 am

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;
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Some Help With Checkpoints

Postby happyjustbecause » Tue Dec 11, 2012 3:09 am

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.
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 267
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron