A weird bug

0 favourites
  • 5 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • I'm experiencing the strangest bug with C2. It's not anything big, but...

    OK, I've got three layouts and I use a global sprite as a transition, having three animations: Default, which is empty (activated when not transitioning), and "FadeIn" and "FadeOut". On the second layout I have a button and when you press it it's supposed to start playing the "FadeIn" animation of the transition sprite, which leads to the third layout. The thing is that this works only when I run my game from the first layout. If I run it directly from the second layout, again - everything works, except one thing: It doesn't activate the "FadeIn" animation. And not only that: While trying to retrieve if I've done anything wrong, I tested printing the animation name on the Chrome console. And guess what - it told me that the animation name that was running at the moment was an empty string. It also told me that the animation had 0 frames and that it's repeating the 0th frame indefinitely. Any idea why?

  • If you really made 3 animations (white, fadeIn and fadeOut), you are storing frames for nothing. Use the "Fade" behavior on your sprite. To be exact, use 2 different "fade" behavior : one for the fadeIn, one for the fadeOut. On start of layout, run the fadeOut. On function "nextLayout", call the fadeIn and use the event on end of fadeIn to trigger the real switch to next layout.

    Also, if it works perfectly on the first layout but not when starting on another layout, try to export your project to see how it does. If you preview from the second layout, thinking the sprite would be in a specific state because first layout should have set it that way, the result won't be what you think. Running from start should help test more precisely.

  • Wow, I should pay more attention to behaviours. <img src="smileys/smiley23.gif" border="0" align="middle" /> Thank you, I'll try that now.

  • I tried what you told me and I unexpectedly ran to another issue. <img src="smileys/smiley7.gif" border="0" align="middle" /> I made two black sprites, both with Fade behaviours. One for FadeIn (fadein time: 1, fadeout time: 0), the other one for FadeOut (fadein time: 0, fadeout time: 1). The only event there is to choose in the event list is "on fade out finished". On both sprites. There's no "on fade in finished" event. <img src="smileys/smiley23.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For this purpose I highly recommend the LightTween plugin. It'll give you much better control from more specific conditions and actions.

    Either that, or use the Sine behaviour with specific periods and starting points, but that might be a bit more hassle than it's worth.

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