Adding logo in the bottom right corner and placing help text in function of height
This commit is contained in:
parent
d2f94e9406
commit
85f84517f6
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
export class TextField extends Phaser.GameObjects.Text {
|
export class TextField extends Phaser.GameObjects.Text {
|
||||||
constructor(scene: Phaser.Scene, x: number, y: number, text: string | string[]) {
|
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)
|
this.scene.add.existing(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,11 +3,13 @@ import {TextField} from "../Components/TextField";
|
|||||||
import {TextInput} from "../Components/TextInput";
|
import {TextInput} from "../Components/TextInput";
|
||||||
import {ClickButton} from "../Components/ClickButton";
|
import {ClickButton} from "../Components/ClickButton";
|
||||||
import {GameSceneName} from "../Game/GameScene";
|
import {GameSceneName} from "../Game/GameScene";
|
||||||
|
import Image = Phaser.GameObjects.Image;
|
||||||
|
|
||||||
//todo: put this constants in a dedicated file
|
//todo: put this constants in a dedicated file
|
||||||
export const LoginSceneName = "LoginScene";
|
export const LoginSceneName = "LoginScene";
|
||||||
enum LoginTextures {
|
enum LoginTextures {
|
||||||
playButton = "play_button",
|
playButton = "play_button",
|
||||||
|
icon = "icon"
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LogincScene extends Phaser.Scene {
|
export class LogincScene extends Phaser.Scene {
|
||||||
@ -15,6 +17,7 @@ export class LogincScene extends Phaser.Scene {
|
|||||||
private textField: TextField;
|
private textField: TextField;
|
||||||
private playButton: ClickButton;
|
private playButton: ClickButton;
|
||||||
private infoTextField: TextField;
|
private infoTextField: TextField;
|
||||||
|
private logo: Image;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
@ -24,18 +27,23 @@ export class LogincScene extends Phaser.Scene {
|
|||||||
|
|
||||||
preload() {
|
preload() {
|
||||||
this.load.image(LoginTextures.playButton, "resources/objects/play_button.png");
|
this.load.image(LoginTextures.playButton, "resources/objects/play_button.png");
|
||||||
|
this.load.image(LoginTextures.icon, "resources/logos/tcm_full.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
create() {
|
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);
|
this.emailInput = new TextInput(this, 10, 50);
|
||||||
|
|
||||||
let x = this.game.renderer.width / 2;
|
let x = this.game.renderer.width / 2;
|
||||||
let y = this.game.renderer.height / 2;
|
let y = this.game.renderer.height / 2;
|
||||||
this.playButton = new ClickButton(this, x, y, LoginTextures.playButton, this.login.bind(this));
|
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.logo = new Image(this, this.game.renderer.width - 30, this.game.renderer.height - 20, LoginTextures.icon);
|
||||||
this.infoTextField = new TextField(this, 10, 300, infoText);
|
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 {
|
update(time: number, delta: number): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user