How do I activate a Weapon Power Up?

0 favourites
  • 2 posts
From the Asset Store
75 power-up sound effects; bonus and notification sounds, fanfares, harp glissandi, stabs, clock ticks, etc.
  • I'm brand new to Construct 2, and I'm trying to make a complex platformer. Smart idea, I know. </sarcasm>

    The issue I'm having right now is related to Power ups. I'm trying to make it so that when my character touches a spinning wrench icon, it switches to him holding the wrench (a different animation), and when he runs, it's playing another animation. However, I want it so that the animation plays for about 10 seconds, then reverts back to the first sprite animations (Idle and Run).

    Please take note that I followed the beginner's tutorial, so his sprite is connected to an invisible PlayerBox object. I've tried duplicating the character sprite so that it replaces the original, but then it gives me problems with the placement (where the duplicate does not exactly follow the PlayerBox, despite me having put 'position to PlayerBox').

    Here is what I currently have in my event sheet:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are, as always, multiple ways of doing this. My first idea is to have an instance variable on the player called something like "PowerUp" and the timer behaviour. When the player collides with the wrench set the PowerUp to "_Wrench"(you can do it without the underscore). Start the timer and make it last 10 seconds and put a tag to something like "power_up". Now, for your animations, whenever you player any animation make it so it plays "Idle" & Tails.PowerUp, "Jump" & Tails.PowerUp, and so on. Since the PowerUp variable will be an empty string in the beginning it will play just "Idle", "Jump", etc. When you collect the wrench it will begin playing "IdleWrench", "JumpWrench", etc. You have to remember to make these animations.

    The last thing is to add an event On timer and make it so when the timer expires(the "power_up" one), just set the Tails.PowerUp to ""(this is an empty string).

    This can also work even better with families, if you want me to further explain how incorporating families will make the code more streamlined and make it so adding new power ups is easy feel free to ask(I don't have time to do so now ).

    I assumed that Tails is the player in the later part.

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