Set Animation Frame bug & logic exec. of subevents

Bugs will be moved here once resolved.

Post » Mon Jul 11, 2011 12:42 am

"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 "Franais".

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

*-*


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:
[code]Sys - Every tick
... Logo.Amplitude >= Logo.AmplitudeMax
...... Logo.Direction = 0 (action: Direction = 100; Amplitude = 0)
...... Logo.Direction = 100 (action: Direction = 0; Amplitude = 0)
[/code])

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 ?Kyatric2011-07-11 00:55:27
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Mon Jul 11, 2011 12:23 pm

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

[quote]if (x is true)
{
    if (y is true) do foo();
    if (z is true) do bar();
}[/quote]

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)Ashley2011-07-11 12:25:04
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Mon Jul 11, 2011 5:00 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests