About time scale and triggers

Discussion and feedback on Construct 2

Post » Thu Apr 17, 2014 4:50 pm

Sorry to bother with this. I'm having doubts and issues I'm not sure how to resolve. I would like to know (if someone have the time to explain it to me, @Ashley ?) how the time scale affects triggers.

I have a function called on browser resize which creates and position a sprite over the viewport (more on this here) if it's in portrait (just to make sure it's played in landscape) and destroy it otherwise. I'm also setting the time scale to zero so as to pause the game. This brings some issues, because the function never gets called again. Is this how it's supposed to work? Why a mouse trigger works while timescale=0 and an on resize trigger does not? Is it a bug?

Thanks,
Juan.
You do not have the required permissions to view the files attached to this post.
B
34
S
8
G
5
Posts: 32
Reputation: 5,404

Post » Thu Apr 17, 2014 5:30 pm

The time scale does not affect triggers. It does however affect the 'Wait' action, so 'Wait 0.2 seconds' will never complete when the time scale is 0.
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Thu Apr 17, 2014 5:49 pm

Ashley wrote:The time scale does not affect triggers. It does however affect the 'Wait' action, so 'Wait 0.2 seconds' will never complete when the time scale is 0.


Great. I knew before I added the wait it was working; between all the tests I got confused...

But now I don't now how to resolve the fact that in chrome the sprite doesn't position correctly when maximizing or restoring the window. Did you happen to see this other link? You can check with this same example tough. In Firefox works better, in IE the same as Chrome. In an android tablet with Chrome happens the same when rotating the screen.


PD: Ups, just noticed there's a spelling error in the file name. Should be "posicionado".
B
34
S
8
G
5
Posts: 32
Reputation: 5,404

Post » Wed Jun 11, 2014 7:51 pm

Sorry for the bump @Ashley but I haven't found a workaround for this last bit yet...
B
34
S
8
G
5
Posts: 32
Reputation: 5,404

Post » Wed Jun 11, 2014 8:20 pm

I'm not clear what you think is wrong with the positioning. What are you expecting to happen?
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Wed Jun 11, 2014 8:44 pm

It's better explained here I think. The thing is, that it would seem that maximizing or restoring the browser doesn't fire the "On resize" event.

The example is just a sprite that covers the viewport and adapts to it whenever the size changes (through the "On resize" event). When I change the window size using the maximize or restore buttons this doesn't happen. Am I missing something?

Eventually, what I'm trying to do is pause a game if it is not in landscape or the aspect ratio is not appropriate.
B
34
S
8
G
5
Posts: 32
Reputation: 5,404


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests