Только добавил сцену проигрыша
Это в компоненте персонажа во время смерти сцена меняется на проигрыш
this.onDeath(() => {
this.destroy()
go("lose")
})А это сама сцена проигрыша:
scene("lose", () => {
add([
text("You Lose", {
size: 50,
}),
pos(center()),
anchor("center"),
])
add([
sprite("moth"),
scale(6),
pos(center().add(0, -100)),
anchor("center"),
{
add() {
this.onMousePress(() => {
this.play("death")
})
this.onAnimEnd((anim) => {
if (anim == "death")
go("game")
})
}
}
])
})