Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default class Player {
- constructor(scene, x, y) {
- this.scene = scene;
- // Create the physics-based sprite that we will move around and animate
- this.sprite = scene.physics.add
- .sprite(x, y, "player", 0)
- .setDrag(1000, 0)
- .setMaxVelocity(300, 400)
- .setSize(18, 24)
- .setOffset(7, 9);
- // Set up animations & keyboard input (see CodeSandbox)
- }
- update() {
- // Move sprite & change animation based on keyboard input (see CodeSandbox)
- }
- destroy() {
- this.sprite.destroy();
- }
- }
Add Comment
Please, Sign In to add comment