Trouble with Event Triggering and Animations

Non-platform specific questions.

Trouble with Event Triggering and Animations

Postby Turon » Fri Dec 30, 2016 1:49 pm

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?
Last edited by Turon on Tue Feb 21, 2017 1:02 pm, edited 1 time in total.
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby Turon » Mon Jan 02, 2017 5:12 pm

Talking views not even posts this is quite a quiet little subforum.
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby Turon » Thu Jan 05, 2017 9:33 am

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.
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby schnellboot » Thu Jan 05, 2017 8:44 pm

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.
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

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

Postby Turon » Sat Jan 07, 2017 6:24 pm

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.
Attachments
SeaCat.zip
(47.74 KiB) Downloaded 146 times
Last edited by Turon on Sat Feb 04, 2017 3:43 pm, edited 1 time in total.
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby schnellboot » Sat Jan 07, 2017 10:01 pm

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
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

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

Postby Turon » Sat Jan 14, 2017 1:18 pm

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?
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby Turon » Mon Feb 06, 2017 4:02 pm

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.
Attachments
SeaCat.zip
(48.05 KiB) Downloaded 137 times
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron