How do I make my character progressively build a sprite ?

0 favourites
  • 5 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hi everyone !

    Thank you for reading this post, I hope someone will be able to help me !

    In my game, I would like my player to progressively build a portal by pressing the space bar.

    I would like that each time I press the spacebar, the sprite of my portal "evolves" gradually into the final version of the portal.

    What I did first, is to make 4 different animations and put "when pressing the space bar, play animation 1", then animation 2, animation 3 and animation 4 ...

    However, as the game did not know how to "separate" each pressure on the spacebar, when I was pressing it, the sprite went directly to animation 4.

    I hope my explanation makes sense ^^'

    Maybe there is an easier way to do this ?

    Thank you in advance ! :)

    Tagged:

  • You may just have mixed up "on key down" with "key press"

    Post a screenshot of your events (or a project file) if that wasn't it.

  • You may just have mixed up "on key down" with "key press"

    Post a screenshot of your events (or a project file) if that wasn't it.

    Hi ! Thank you for your reply !

    My construct is in french, so it may be useless that I put a screenshot. But what you are explaining was not the issue^^

    I would like that each time I press the spacebar, a new animation plays.

    It would be like :

    Press spacebar --> play animation 1

    Second press spacebar --> play animation 2

    Third press spacebar --> play animation 3

    Forth press spacebar --> play animation 4

    But when I tried it, it did not work as I could not tell how many time do I have to press the spacebar to obtain the 4th animation...

    It is basically the same concept as an energybar but with the drawing of a portal : to see the progression of the portal as I press the space bar.

    So maybe there is another way to do so ?

    I hope it makes sense :D

    Thank you ! :)

  • It may not be the best way but I tried it here and it worked.

    On your Sprite, set the animations name in a numeric order, starting from 1.

    Create 2 instance variables on your sprite, one will store the amount of animations and the second one the current animation

    This way it will change animations till reach the last one and start again from the first one. You can also destroy it when there is no more animations or do whatever you want, just compare if current is equal to animations.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It may not be the best way but I tried it here and it worked.

    On your Sprite, set the animations name in a numeric order, starting from 1.

    Create 2 instance variables on your sprite, one will store the amount of animations and the second one the current animation

    This way it will change animations till reach the last one and start again from the first one. You can also destroy it when there is no more animations or do whatever you want, just compare if current is equal to animations.

    OH MY GOD !! THANK YOUUUU !!! Thank you so much ! This is EXACTLY what I needed in my game !!! You are a true savior ! Have a nice day ! :)

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