export class TextField extends Phaser.GameObjects.Text {
constructor(scene: Phaser.Scene, x: number, y: number, text: string | string[]) {
- super(scene, x, y, text, { fontFamily: 'Arial', fontSize: "20px", color: '#ffffff'});
+ super(scene, x, y, text, { fontFamily: 'Arial', fontSize: "15px", color: '#ffffff'});
this.scene.add.existing(this)
}
-}
\ No newline at end of file
+}
import {TextInput} from "../Components/TextInput";
import {ClickButton} from "../Components/ClickButton";
import {GameSceneName} from "../Game/GameScene";
+import Image = Phaser.GameObjects.Image;
//todo: put this constants in a dedicated file
export const LoginSceneName = "LoginScene";
enum LoginTextures {
playButton = "play_button",
+ icon = "icon"
}
export class LogincScene extends Phaser.Scene {
private textField: TextField;
private playButton: ClickButton;
private infoTextField: TextField;
+ private logo: Image;
constructor() {
super({
preload() {
this.load.image(LoginTextures.playButton, "resources/objects/play_button.png");
+ this.load.image(LoginTextures.icon, "resources/logos/tcm_full.png");
}
create() {
- this.textField = new TextField(this, 10, 10, 'Enter your email:');
+ this.textField = new TextField(this, 10, 10, 'Enter your name:');
this.emailInput = new TextInput(this, 10, 50);
let x = this.game.renderer.width / 2;
let y = this.game.renderer.height / 2;
this.playButton = new ClickButton(this, x, y, LoginTextures.playButton, this.login.bind(this));
- let infoText = "Commandes de base: \n - Z,Q,S,D (ou les flèches de direction) pour bouger\n - SHIFT pour accélerer";
- this.infoTextField = new TextField(this, 10, 300, infoText);
+ this.logo = new Image(this, this.game.renderer.width - 30, this.game.renderer.height - 20, LoginTextures.icon);
+ this.add.existing(this.logo);
+
+
+ let infoText = "Commands: \n - Arrows or Z,Q,S,D to move\n - SHIFT to run";
+ this.infoTextField = new TextField(this, 10, this.game.renderer.height - 60, infoText);
}
update(time: number, delta: number): void {
this.scene.start(GameSceneName);
});
}
-}
\ No newline at end of file
+}