Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default class Intro extends Phaser.Scene {
- private _logo: Phaser.GameObjects.Image;
- private _cursors: Phaser.Types.Input.Keyboard.CursorKeys;
- private _last_pos: integer = 0 ;
- constructor() {
- super({
- key: "Intro",
- });
- }
- preload() {
- }
- create() {
- this.cameras.main.setBackgroundColor("#782045");
- console.log("create:intro");
- //dichiarazione immagine gioco
- this._logo = this.add.image(this.game.canvas.width / 2, this.game.canvas.height / 4, "logo-gioco").setScale(9, 9);
- //dichiarazione testo
- this.add.text(this.game.canvas.width/2, ((this.game.canvas.height/2)+50), 'Gioca', { color: '#000000' }).setInteractive().on("pointerup", () => {console.log("restartato")}).setOrigin(0.5 , 0.5);
- this.add.text(this.game.canvas.width/2, ((this.game.canvas.height/2)+125), 'Guida', { color: '#000000' }).setInteractive().on("pointerup", () => {console.log("restartato")}).setOrigin(0.5 , 0.5);
- this.add.text(this.game.canvas.width/2, ((this.game.canvas.height/2)+200), 'Crediti', { color: '#000000' }).setInteractive().on("pointerup", () => {console.log("restartato")}).setOrigin(0.5 , 0.5);
- //dichiarazione cursore
- this._cursors = this.input.keyboard.createCursorKeys();
- }
- update(time: number, delta: number): void {
- this._logo.rotation += .01;
- //se il tasto cursore down รจ premuto
- if (this._cursors.up.isDown) {
- console.log("sopra");
- this._last_pos ++ ;
- }
- //se il tasto cursore down รจ premuto
- else if (this._cursors.down.isDown) {
- console.log("giu");
- this._last_pos -- ;
- }
- console.log(this._last_pos) ;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment