Hi please help me,
I’m writing my first phaser game at the moment,
but now i have problem with timer ,
the system only read once on function,
i already read and try example on grup and lab phaser io but problem always same
here my code
class Scene5 extends Phaser.Scene{
constructor(){
super(“test”);
}
preload()
{
c = 0;
this.load.image(‘stg1’, ‘assets/stg1.png’);
}
create()
{
image = this.add.image(400, 300, ‘stg1’);
text = this.add.text(32, 32);
timedEvent = this.time.addEvent({ delay: 500, callback: this.onEvent(), callbackScope: this, loop: true });
}
update()
{
text.setText('Event.progress: ’ + timedEvent.getProgress().toString().substr(0, 4) + '\nChange Scene at 10: ’ + c);
}
onEvent()
{
c++;
if (c === 10)
{this.scene.start(“bootGame”);}
}}
and the result :
Event.progress:0.-- (it keep counting)
Change Scene in : 1 (it keep stuck at 1)
i am new at phaser and thank for hearing my problem,