Trying to do stuff when time scale = 0

For questions about using Classic.

Post » Sat Oct 09, 2010 2:43 pm

I'm setting time scale to 0 to pause my game. When the game is paused, I want to display an animated sprite. I also want to autoplay a sound.
But setting time scale to 0 seems to cause most actions not to run.

Playing music works but it causes lag and I want to avoid that.
Is there any way around this problem?
B
5
S
1
G
3
Posts: 59
Reputation: 993

Post » Sat Oct 09, 2010 8:17 pm

When time scale is 0 you can still do a lot of manual manipulations of things. You can still move sprites by explicitly stating the pixel coordinates (though you don't get the benefit of timedelta), and you can still show animated sprites by manually setting the frame of the sprite. You would need to make your own series of events to do so though. Something like "+Every X Milliseconds -> Set animation frame to current frame + 1." You'll also need an extra event to check that it sets back to 1 when it reaches the end.

As for the sound issue, I'm not entirely sure about that.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Oct 10, 2010 8:13 pm

Here's a trick: Within the events you're running with Timescale set to 0, temporarily set Timescale to 1 and then you can use Timedelta as usual. Don't forget to set Timescale back to 0 once you're out of that block :)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Oct 10, 2010 9:52 pm

[quote="madster":1deth1up]Here's a trick: Within the events you're running with Timescale set to 0, temporarily set Timescale to 1 and then you can use Timedelta as usual. Don't forget to set Timescale back to 0 once you're out of that block :)[/quote:1deth1up]

I did not know that. That does sound like a handy trick :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest