I define a new frame every click mouse

0 favourites
  • 8 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • I created a square with 4 animation frames and in start on layout I defined animation for stop.

    Each frame is the square missing a piece, from 0 to 3, 0 is the entire square and 3 is the most broken.

    I want it to be more broken with each click. But it's not working.

    Each click it changes the frame, but compare, if it is in frame 0 it changes to 1, if it is in 1 it changes to 2, and so on. But when I click it, it changes straight to frame 3. Why? Where am I going wrong?

    This test is just because I want to create different collision animations in the future, but it is not working.

  • I had an idea to do with variables and it worked lol. I ended up finding the answer alone here.

    It looked like this:

  • The issue is that all three events will trigger on the mouse click in sequence because each event is setting the conditions for the next one; event 2 sets the frame to 1 so event 3 is true, and so on.

    Here's one way to deal with this:

    On left button clicked on sprite: Set animation frame to min(self.animationFrame+1, self.animationFrameCount-1)

    This will step up the frame number each time you click up to the maximum frame number (animationFrameCount-1).

    Here's another:

    On left button clicked on sprite:

    =>Sprite animation frame = 0: set animation frame to 1

    =>Else Sprite animation frame = 1: set animation frame to 2

    =>Else: set animation frame to 3

    In this example you use a sequence of "Else" sub-events to allow you to step the frame number.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When i want to do something like that i usually create a single animation for each "frame", then i use a variable that increases by 1 every time you click on the block, then i link the value of the variable to each animation. Hopefully this helped and you understood it.

  • Ziwer Black but that's how I did it as I posted up there that I found the answer. Thanks for the replies thanks. I will try the other TB method. Thanks for replying

    Ziwer Black mas foi assim mesmo que eu fiz conforme postei ali em cima que eu descobri a resposta. Obrigado pelas respostas obrigado. Vou tentar o método outro do outro TB. Obrigado por responderem

  • And thanks mekonbekon

    E obrigado mekonbekon

  • lincolnsalles I've warned you about this already. This is an English-language forum, so you must include a translation if you insist on posting in another language. Google Translate is fine.

    This is specified in the forum guidelines.

  • Laura_D I have used the translator, as other posts attest, in these I ended up forgetting, sorry.

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