Page 1 of 1

Trouble with Event Triggering and Animations

PostPosted: Fri Dec 30, 2016 1:49 pm
by Turon
The reason I'm asking this is because I've been trying to implement shooting into a platformer but there are many bugs such as the bullets being of inconsistent spaces apart and clumping together if the player moves. The System I have in place is pretty much the same as the one used in the Space Invaders tutorial except the shooting direction is controlled by the value of the 'state' variable. Is there a better way?

Re: Has anyone built a Metroid or Megaman-like Gun System?

PostPosted: Mon Jan 02, 2017 5:12 pm
by Turon
Talking views not even posts this is quite a quiet little subforum.

Re: Has anyone built a Metroid or Megaman-like Gun System?

PostPosted: Thu Jan 05, 2017 9:33 am
by Turon
I've found that the bullets are less likely to overlap if your set it's speed to 10 or 20 like yvelocity -= 10;. I'm still working at it. one bug I can't understand is why shooting allows the player to fly.

Re: Has anyone built a Metroid or Megaman-like Gun System?

PostPosted: Thu Jan 05, 2017 8:44 pm
by schnellboot
Turon wrote:I've found that the bullets are less likely to overlap if your set it's speed to 10 or 20 like yvelocity -= 10;. I'm still working at it. one bug I can't understand is why shooting allows the player to fly.

I cannot see anything.

Re: Has anyone built a Metroid or Megaman-like Gun System?

PostPosted: Sat Jan 07, 2017 6:24 pm
by Turon
schnellboot wrote:
Turon wrote:I've found that the bullets are less likely to overlap if your set it's speed to 10 or 20 like yvelocity -= 10;. I'm still working at it. one bug I can't understand is why shooting allows the player to fly.

I cannot see anything.

Sorry, I should have uploaded the .ged... I have a hunch it's got something to do with my collider actor's relations with the player actor.

Re: Has anyone built a Metroid or Megaman-like Gun System?

PostPosted: Sat Jan 07, 2017 10:01 pm
by schnellboot
Turon wrote:one bug I can't understand is why shooting allows the player to fly.

1. shooting -> state = STOP_LEFT;
2. STOP_LEFT -> allow jump

Re: Has anyone built a Metroid or Megaman-like Gun System?

PostPosted: Sat Jan 14, 2017 1:18 pm
by Turon
schnellboot wrote:
Turon wrote:one bug I can't understand is why shooting allows the player to fly.

1. shooting -> state = STOP_LEFT;
2. STOP_LEFT -> allow jump

I see now... now I'll just need to fix that, I need to get the player to not be displaying a shoot animation yet also not unnecessarily triggering a jump ability. I don't supposed I'd need a new variable?

Re: Has anyone built a Metroid or Megaman-like Gun System?

PostPosted: Mon Feb 06, 2017 4:02 pm
by Turon
I've just introduced a variable called 'being' to be use alongside 'state' (thanks lcl). Sometimes it seems to work, other times there are bugs like being stuck to the ground or jumping midair while diagonally moving.
there are two additional constants for the variable 'being', they share values with two existing constants.
Code: Select all
#define STOP_LEFT 0
#define OFF_GROUND 0
#define STOP_RIGHT 1
#define ON_GROUND 1
#define RUN_LEFT 2
#define RUN_RIGHT 3
#define JUMP_LEFT 4
#define JUMP_RIGHT 5
#define FALL_LEFT 6
#define FALL_RIGHT 7
#define SHOOT_LEFT 8
#define SHOOT_RIGHT 9

At the end of player Collision top side of ground I set being to ON_GROUND.
Code: Select all
switch(state)
{
    case STOP_LEFT:
    break;


    case STOP_RIGHT:
    break;


    case RUN_LEFT:
    break;


    case RUN_RIGHT:
    break;


    case JUMP_LEFT:
    ChangeAnimation("Event Actor", "StandRight", NO_CHANGE);
    state = STOP_LEFT;
    break;


    case JUMP_RIGHT:
    ChangeAnimation("Event Actor", "StandLeft", NO_CHANGE);
    state = STOP_LEFT;
    break;


    case FALL_LEFT:
    ChangeAnimation("Event Actor", "StandRight", NO_CHANGE);
    state = STOP_LEFT;
    break;


    case FALL_RIGHT:
    ChangeAnimation("Event Actor", "StandLeft", NO_CHANGE);
    state=STOP_RIGHT;
    break;


    case SHOOT_LEFT:
    break;

    case SHOOT_RIGHT:
    break;
    // turning animation


}
being = ON_GROUND;

It was my hope that this condition would prevent any unintended jumping. Though when jumping diagonally you can still do a midair jump.
Code: Select all
switch(state)
{
    case STOP_LEFT:
    if(being == ON_GROUND)
    {
      ChangeAnimation("Event Actor", "JumpRight", NO_CHANGE);
      player_collider.yvelocity=-12;
      state = JUMP_LEFT;
    }
    break;


    case STOP_RIGHT:
    if(being == ON_GROUND)
    {
      ChangeAnimation("Event Actor", "JumpLeft", NO_CHANGE);
     player_collider.yvelocity=-12;
     state = JUMP_RIGHT;
    }
    break;


    case RUN_LEFT:
    ChangeAnimation("Event Actor", "JumpRight", NO_CHANGE);
    player_collider.yvelocity=-12;
    state = JUMP_LEFT;
    break;


    case RUN_RIGHT:
    ChangeAnimation("Event Actor", "JumpLeft", NO_CHANGE);
    player_collider.yvelocity=-12;
    state = JUMP_RIGHT;
    break;


    case FALL_LEFT:
    break;


    case FALL_RIGHT:
    break;


   case SHOOT_LEFT:
    break;

    case SHOOT_RIGHT:
    break;
    // turning animation


}

I have a collision finish event with the ground, it's very short.
Code: Select all
being = OFF_GROUND;

And I have the .ged if anyone would like to see it.