Skip to content

Commit

Permalink
fix: Enemy is frozen for first 2 secs
Browse files Browse the repository at this point in the history
This is a fix so that respawned enemies won't immediately kill the
player if they respawn on top of them.
  • Loading branch information
joshuacurtiss committed Jul 29, 2024
1 parent 0703e61 commit 3329e13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/objects/Enemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function enemy(options: Partial<EnemyCompOpt> = {}): EnemyComp {
wait(randi(8, 20), ()=>{
this.setAnim(vec2(0));
this.pos = opt.pos.clone();
this.unfreeze();
wait(2, ()=>this.unfreeze());
});
},
stun() {
Expand Down
2 changes: 1 addition & 1 deletion src/objects/Peter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function peter(options: Partial<PeterCompOpt> = {}): PeterComp {
slices: [],
add() {
this.onCollide("enemy", enemy=>{
if (enemy.isStunned) return;
if (enemy.isStunned || enemy.isFrozen) return;
this.die();
});
this.on(ON_DIE, ()=>{
Expand Down

0 comments on commit 3329e13

Please sign in to comment.