How does "Flash" work?

For questions about using Classic.

Post » Mon Mar 09, 2009 4:49 am

When setting a sprite to Flash, the options are for "Frames" and "Frame interval." What exactly constitutes a "frame?" If I wanted to flash a sprite for 3000ms, what would I put?

And wouldn't milliseconds make more sense, since everything else is done in milliseconds?


Edit:
Hmm, I think I've figured it out... if I want three seconds of flashing, I set it to 180 interval? Does that sound right? Confirmation, please :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Mar 09, 2009 6:06 am

Does frame rate effect it?
edit: yes it does
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Mon Mar 09, 2009 8:27 am

[quote="newt":1veh23he]Does frame rate effect it?
edit: yes it does[/quote:1veh23he]

Well, that's no good :(

All the more reason to change it to milliseconds. I hereby officially request this change :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Mar 09, 2009 10:51 am

It's framerate dependent. It shouldn't really be there or it should be fixed, because obviously framerate dependent stuff sucks. The parameter is currently interval in ticks between flashing, when it should be in milliseconds. You should probably invent your own flash code.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Mar 09, 2009 5:26 pm

flashing based on frames is still useful though... in old-school games transparency was made this way and it stuck around even when not needed anymore.

On respawn set invulnerable and flash every other frame, etc, and you could coordinate complex flashing patterns between different objects for visual trickery.

I'd use both.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Mon Mar 09, 2009 6:16 pm

I know you could do this with the timeline object, I tried a bit but couldn't get it to work exactly.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Mon Mar 09, 2009 6:18 pm

Could use the timer behavior, also.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Mon Mar 09, 2009 10:17 pm

Ugh, found a bug when trying to make my own flashing work:

https://sourceforge.net/tracker/index.p ... id=1003219

Anyway, I'm also having problems with an alternate method of flashing a sprite:

http://willhostforfood.com/users/D/deadeye/flash.cap

The blue sprite is meant to turn invisible every 150ms, and turn visible every 300ms. It does work... but very poorly. For some reason it's flickery and inconsistent :(. This is for my tutorial, so I'm looking for the most concise, simple, and non-hacky-workaroundish method possible for flashing a sprite. Having the "Flash" action work based on milliseconds would solve this perfectly.

[quote="Rich":3ak1qg0r]Could use the timer behavior, also.[/quote:3ak1qg0r]

I did try that, and ran into another bug. I'll try to recreate it and post that a bit later on. As I said before though, I am looking for the most basic and concise method for the tutorials, and honestly using the timer behavior just seems like overkill. It's a workaround that simply wouldn't be necessary if the Flash action were updated.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Mar 11, 2009 3:32 am

[quote="deadeye":1m2tp8mc]The blue sprite is meant to turn invisible every 150ms, and turn visible every 300ms. It does work... but very poorly. For some reason it's flickery and inconsistent :([/quote:1m2tp8mc]

Did some tests with the .cap. If you let it run with unbounded fps, blue sprite becomes very consistent. My guess is with vsync on, the time in which something is displayed and the time when it's calculated is slightly different, so tiny measurements like this will be inconsistent. Construct is double buffered I think, triple buffering mitigates these things somewhat but not completely. This is why I prefer doing things frame-based when the timing's really tight (and it doesn't affect logic).

I can't make heads or tails out of "else". Tried making it a subevent and it does flash... for like a single frame.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests