1 decade ago by Joncom
In my game Scary Chicken, some people have reported that they instantly win after eating the first egg (it counts as more than one egg).
I suspect this is because the egg is not being killed fast enough, and the fox thinks he collided with it more than one time.
Here is my fox entity method for dealing with egg collisions:
ImpactJS does not use threads, correct? So that means there is zero chance that an egg entity could trigger
I suspect this is because the egg is not being killed fast enough, and the fox thinks he collided with it more than one time.
Here is my fox entity method for dealing with egg collisions:
// Handle collisions with other entities. check: function(other) { if( other.name === 'chicken' ) { // Collided with the chicken. if( !this.god ){ // Draw game over message to screen. ig.game.spawnEntity(EntityGameOver, 0, 0, { status: 'lose' } ); // Chicken makes no more noises. ig.game.chicken.soundTimer.set(99999); this.kill(); } } else { // Collided with an egg. this.eaten++; // Game over? if( this.eaten === ig.game.eggTotal ) { ig.game.spawnEntity(EntityGameOver, 0, 0, { status: 'win' }); ig.game.chicken.kill(); ig.game.clock.timer.pause(); // High score? if( ! ig.game.highscore ) ig.game.highscore = ig.game.clock.timeString; else { // A high score already exists, overwrite? if( ig.game.highscore > ig.game.clock.timeString ) { // New highscore! ig.game.highscore = ig.game.clock.timeString; } } } this.eatSound.play(); // Chicken becomes more aggressive. ig.game.chicken.setBehaviour( ig.game.chicken.behaviour + 1 ); // Set music to match chicken aggressiveness. ig.music.play('track' + ( ig.game.chicken.behaviour + 1 ) ); // Kill the egg entity. other.kill(); } }
ImpactJS does not use threads, correct? So that means there is zero chance that an egg entity could trigger
fox.check()
more than once?