import { Physics } from 'phaser'; import { SUPER_JUMP_VELOCITY } from '../config/game.config.js'; export class Spring extends Physics.Arcade.Sprite { constructor(scene, x, y) { super(scene, x, y, 'spring'); scene.add.existing(this); scene.physics.add.existing(this, true); this.setScale(1); this.body.setSize(20, 32); this.active = true; } onPlayerTouch(player) { if (!this.active) return false; this.active = false; this.setVisible(false); this.body.enable = false; player.jump(SUPER_JUMP_VELOCITY); return true; } }