Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//ball.ts
import { Mesh} from "@babylonjs/core";
import GameComponent from "./game";
export default class BallComponent extends Mesh {
public _scene: GameComponent;
//...
/**
* Called each frame.
*/
public onUpdate(): void {
this.position.y = this._startHeight;
if (this.position.x < -30) {
this._scene.retry();
}
}
//...
}
//game.ts
////.....
import { Scene } from "@babylonjs/core";
export default class GameComponent extends Scene {
///...
/**
* THe player lose, let's retry :)
*/
public retry(): void {
// do something..
///...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.