1 decade ago
by Joncom

/* main.js */
totalTimer: null,
config: { timelimit: 30 },
init: function() {
this.totalTimer = new ig.Timer(this.config.timelimit);
this.totalTimer.pause();
}
I then have a timelimit entity which formats the output of
ig.game.totalTimer.delta()
and draws it on screen as in the screenshot.
The problem is that the timer should be paused.
And it is on my PC. Also on my iPod.
However, it is not on my iPad.
On the iPad, the timer immediately starts counting when the app loads.
And there is literally not a single
totalTimer.unpause()
anywhere in my code.
No errors.
Any ideas?
1 decade ago
by Joncom
My "fix" which is really sloppy:
It feels really really really unnecessary, but alas here we are.
update: function() {
// This is a silly workaround to keep the timers "paused" because
// for some reason the iPad won't register the pause in init.
if(!this.started) {
this.totalTimer.reset();
this.questionTimer.reset();
}
}
1 decade ago
by dominic
Are you using Ejecta? If not, which browser, or framework? Which Impact version?
This was a bug in Impact, prior to
version 1.21:
Fixed issue with ig.Timer pause() not working on the very first frame
There was also a bug in Ejecta where JavaScript&
039;s #Number.MIN_VALUE
was
0
instead of
5e-324
- I also observed this bug in Chrome for iOS and it&
039;s quite likely that it's present in PhoneGap too. #ig.Timer
needs this to work.
The latest version of
Ejecta on github doesn't have this problem anymore.
Another quick fix for the problem is to set the timer's time to something non-zero before starting your game:
ig.Timer.time = 0.0001;
ig.main( ... );
1 decade ago
by Joncom
Not using Ejecta.
Using ImpactJS version: '1.22'
.
Using Safari for iPad.
It's possible that it's an Apple thing, I suppose, because the iPad is running iOS 4.3.3, and thus an older Safari.
Page 1 of 1
« first
« previous
next ›
last »