Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Chocobois/TurtleTrampoline
Browse files Browse the repository at this point in the history
  • Loading branch information
LuxxArt committed Nov 18, 2023
2 parents 7519382 + 2a8116d commit 4407406
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Turtle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Turtle extends Button {
this.spriteSize = 200;
this.sprite = this.scene.physics.add.sprite(0, 0, "turtle_waiting");
this.sprite.setGravityY(constants.physics.gravity);
this.sprite.setCollideWorldBounds(true)
this.sprite.setCollideWorldBounds(true, 1, 1, true);
this.sprite.setBounceY(0.4);
this.sprite.setOrigin(0.5, 1.0);
this.sprite.y += this.spriteSize / 2;
Expand Down
6 changes: 5 additions & 1 deletion src/scenes/OverworldState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export class OverworldState extends Phaser.GameObjects.Container {

this.scene.physics.add.collider(turtle.sprite, this.trampoline.sprite, () => {
turtle.sprite.setVelocityY(-800 + (Math.random()*100-50));
})
});

this.scene.physics.world.on('worldbounds', (body: any) => {
// world collision event
});

turtle.on("action", () => {
turtle.doABarrelRoll();
Expand Down

0 comments on commit 4407406

Please sign in to comment.