Small animation issue

1 favourites
  • 9 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hi,

    I've run into a small but annoying animation issue while play testing a nearly finished game. On getting a certain score the player sprite's projectile sprites change colour, and the enemy sprite is supposed to change as well. The enemy sprite sometimes changes but randomly displays the pre-high score colour scheme instead. How do I fix this? Link to the c3p file is below.

    drive.google.com/open

  • I like the art :)

    what happens is that event 3 fires a red HWB, and event 9 fires a gold HWB (if the highscore is over 80).

    if the highscore is over 80, both are fired, but you make the red one invisible, and the gold one visible (down in event 26).

    both projectiles will hit the enemy, so both events 10 and 11 will run. Since the gold projectile is slightly faster, it will hit first and then the red one hits and changes the animation to f1 (red HWB) right after the it had been set to the f4 (gold HWB). If they hit at the same time, then the f4 animation is set last so you will see the f4 animation.

    so, you don't want to fire the red HWB if you are going to fire the gold one.

    or you might want to make the gold one a new animation of the red HWB, and then set speed as necessary. That would remove duplicate code...

    there may be a bug with the end of game not always stopping play, but I didn't look into that.

  • Hi AllanR, thanks for helping me out.

    I've added the gold projectile as a new animation and the original issue is fixed, but I can't work out how to get the enemy sprite to display the new colour, I just keep getting the original red one. I've tried adding a new event, sub-event and condition but none of these are working.

    I also noticed the bug where the game doesn't end correctly sometimes. So far I haven't been able to work out what's causing it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I made a bunch of little changes - added a couple global variables for projectile type, and changed some animation names to match the projectile types to make it easier to set the one you want.

    I removed some of the "on animation finished" events because they weren't needed - the fade behavior automatically destroys the object when the fade is finished.

    I restructured a couple events, removed some duplicate code, and added a couple checks for game over so that the game can't continue after you are dead...

    https://www.rieperts.com/games/forum/ColdUpdate.c3p

  • Thank you so much for this, I'm very grateful. :) Hopefully one day I'll understand enough to stop making so many errors in the first place.

    Could I just ask what a Global string is, and why it was used instead of a Global number in some cases?

  • a Global string works exactly like a numeric one, only it hold text instead of numbers. That way you can use words, like "Red" and "Gold" rather than codes like 1 or 2.

  • Many thanks for explaining this. In the updated version you provided, how did you get the Touch and System events together in event 3? When I try to replicate this by adding a condition I keep getting an "OR" block.

  • after you add the second condition, right click on the event and choose the first option after the Add... line, it should say "Make AND block". (if you do that again it will say "Make OR block" - you can toggle it back and forth as required).

  • Many thanks. :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)