-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56cd6bb
commit 30c5eea
Showing
13 changed files
with
102 additions
and
59 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export class Button extends Phaser.GameObjects.Container { | ||
constructor(scene: Phaser.Scene, x: number, y: number, icon: string, text: string) { | ||
super(scene, x, y, []); | ||
|
||
let i = scene.add.image(0, 0, icon); | ||
let f = new Phaser.GameObjects.Ellipse(scene, 0, 0, 64, 64, 0xffffff); | ||
|
||
let t = scene.add.text(0, 36, text, { | ||
fontFamily: 'monospace', | ||
fontSize: 16, | ||
color: '#ffffff', | ||
align: 'center' | ||
}).setOrigin(0.5, 0); | ||
|
||
this.add(f); | ||
this.add(i); | ||
this.add(t); | ||
|
||
this.setSize(64, 64); | ||
this.setInteractive(); | ||
|
||
scene.add.existing(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Tilemaps } from "phaser"; | ||
import { Button } from "./Button" | ||
|
||
export class ButtonArray extends Phaser.GameObjects.Container { | ||
constructor(scene: Phaser.Scene, x: number, y: number, width: number, buttons: Button[]) { | ||
super(scene, x, y, buttons); | ||
|
||
let spacing = 16; | ||
|
||
let diff = 0 + width / 2 - (this.length * width + (this.length - 1) * spacing) / 2; | ||
|
||
for (let i = 0; i < this.length; i++) { | ||
let item = this.getAt(i) as Button; | ||
item.setX(diff); | ||
diff += width; | ||
if (i < this.length - 1) { | ||
diff += 16; | ||
} | ||
} | ||
|
||
scene.add.existing(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters