How do I correctly switch colors and weapons for different power-ups?

0 favourites
  • 3 posts
From the Asset Store
75 power-up sound effects; bonus and notification sounds, fanfares, harp glissandi, stabs, clock ticks, etc.
  • I'm building a test game so I can learn the software better. I've made an infinite runner using Mega man as the main character just so I could work with something familiar until I can swap out the sprites.

    Everything was going well until I added a third power up. Now, the game starts and spawns every frame of the animations as a separate instance attached to my main playerBlock... so rather than seeing 1 Mega Man, I have 10 overlapping in one spot, all firing at the same time, and every time I get a power up, it multiplies the problem to broken hilarity; even exponentially multiplying the number of power-ups dropped.

    How it should work:

    Start as Blue and shoot small power pellets

    Collecting a red can makes you Red and you shoot fireballs

    Collecting a yellow can makes you Yellow and you shoot huge Giga Blasts

    Only power pellets will spawn red cans

    Only fireballs will spawn yellow cans

    Taking damage from an enemy knocks you down to the previous power level.

    I have included a screenshot and a link to my game file for demonstration purposes. Any advice would be appreciated.

    https://drive.google.com/file/d/1Qq8r3ysbthYF2o--v8G5tDlS8cyY8k_x/view?usp=sharing

  • In your layout you have all 3 colours present offscreen at startup and you are then setting them all to the same position and telling them all to to do things at runtime. Your last events are spawning new playeranimations every tick which is why you are seeing many of them

    To solve the problem you have, you need to delete the red and yellow playeranimation objects from the layout in the editor, remove the destroy player actions you have and then add the destroy player actions for the remaining colours in events 36,37 & 38. Also add a 'trigger once while true' condition to the bottom of these events. This will get the game functioning. See attached file. 1drv.ms/u/s!AkmrWgxeuxlKhIc4iUkvbuYBV-bCLQ

    This is however not a very good way to lay out your code. You would be better off using sub events and organising your player animations/actions etc underneath the parent events of 'playercolor=1' 'playercolor=2' etc. I would suggest moving all of your colour animations into a single object and naming them yellowrun, bluerun etc. Have a look at this version to see what I'm talking about. I have moved all of your player controls to Events 26-40. 1drv.ms/u/s!AkmrWgxeuxlKhIc5iOcuSbRLVwrTfA

    Mega Man Rocks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much. That works a lot better and your version is so much cleaner. Thank you for clearing things up.

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