Set Animation Frame bug & logic exec. of subevents

0 favourites
  • 3 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • "Set Animation Frame" bug & logical execution of subevents

    0.e.capx

    C2 r47; Windows XP; FireFox 5; ATI Radeon HD 4800

    The .capx is a work in progress, quite messy and does not make much sense so far. Comments are mostly in french but there is not much so far, so it should be nevertheless understandable.

    I'm having little characters animated (RunnerZ). As they're white colored, I want to put a sprite in front of them that will colorize them. (Sprite "Couleur", effect "Source atop", 65% opacity).

    In my default animation in Couleur, I've made 4 frames (each being a color). When I try to set animation frame to random(0,3) (one of my four frames) the app seems to just freeze.

    In the capx you can see toggled code at the Couleur's creation (if untoggled the app won't execute at all) and the same code when you click the button "Fran?ais".

    The expected behavior would be for the app to go on in its execution and the color on top of the RunnerZ to change to one of Couleur's colors/frames.

    Moreover, when changing the effect on "Couleur", it seems the behavior of the sprites changes (in "XOR" for example, "Couleur" are always placed on/under "RunnerZ" even after the "screen warp" (not the case for "Source atop" that seem to only have one "Couleur" sticking to a "Runnerz" after warp whereas the other "Couleur" seem to get stuck on the left of the screen and only appear when "crossed" by a "RunnerZ"))

    XOR 0

    XOR 1

    Source atop 0

    Source atop 1

    <center>*-*</center>

    Now more of a notice about the execution of the subevents.

    With the capx I gave. I tried to emulate CC's "sine" behavior.

    If you take in "System - every tick" the two subevents "Logo.Amplitude >= Logo.AmplitudeMax". Try to gather them into a single block.

    (I mean:

    Sys - Every tick
    ... Logo.Amplitude >= Logo.AmplitudeMax
    ...... Logo.Direction = 0 (action: Direction = 100; Amplitude = 0)
    ...... Logo.Direction = 100 (action: Direction = 0; Amplitude = 0)
    

    )

    The event "Logo.Amplitude >= Logo.AmplitudeMax" isn't tested again inbetween the "Logo.Direction" subevents.

    As you can see in the code of "Logo.Direction = 0" I intend the first condition to be false by reseting the value Amplitude.

    Nevertheless, the subevent "Logo.Direction = 100" is executed (as Direction is now indeed of value 100).

    As you can see my workaround was to test twice if "Logo.Amplitude >= Logo.AmplitudeMax". But at first, I didn't, and ended with my object just moving down (always in Direction = 0).

    Is it the normal/expected behavior ?

  • I'm looking in to the other issues, but the way the subevents are working is as intended. The parent event is not re-tested between subevents. This is the same as 'if' statements in programming languages. Something like

    f (x is true)

    {

        if (y is true) do foo();

        if (z is true) do bar();

    }

    The condition x is only tested once. If it's true, the entire block inside it is executed. If foo makes x false, it will still test z and run bar. C2 works the same way: if a parent event is true, all its subevents are executed, regardless of whether they make the parent event false or not.

    (Note: 'every tick' has no effect, you may as well get rid of it, it's only there to save you having empty events)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This should be fixed in the next build, so I'm moving the thread to 'fixed'. Post a new thread if you still have problems.

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