GitLab system status is available here and here

Commit f0128cb2 authored by Aaron Gonzales's avatar Aaron Gonzales
Browse files

Added Menu and Play scenes

parent 64a7fe26
......@@ -5,9 +5,16 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rocket Patrol</title>
<style>
body {
background-color: beige;
}
</style>
</head>
<body>
<script src="./lib/phaser.js"></script>
<script src="./src/scenes/Menu.js"></script>
<script src="./src/scenes/Play.js"></script>
<script src="./src/main.js"></script>
</body>
</html>
\ No newline at end of file
let config = {
type: Phaser.CANVAS,
width: 640,
height: 480
height: 480,
scene: [Menu, Play]
}
let game = new Phaser.Game(config);
\ No newline at end of file
let game = new Phaser.Game(config);
// Define global variables for UI size
let borderUISize = game.config.height / 15;
let borderPadding = borderUISize / 3;
\ No newline at end of file
class Menu extends Phaser.Scene {
constructor() {
super("menuScene");
}
create() {
this.add.text(20, 20, "Rocket Patrol Menu");
this.scene.start("playScene");
}
}
\ No newline at end of file
class Play extends Phaser.Scene {
constructor() {
super("playScene");
}
create() {
// green UI background
this.add.rectangle(0, borderUISize + borderPadding, game.config.width, borderUISize * 2, 0x00FF00).setOrigin(0, 0);
// white borders
this.add.rectangle(0, 0, game.config.width, borderUISize, 0xFFFFFF).setOrigin(0, 0);
this.add.rectangle(0, game.config.height - borderUISize, game.config.width, borderUISize, 0xFFFFFF).setOrigin(0, 0);
this.add.rectangle(0, 0, borderUISize, game.config.height, 0xFFFFFF).setOrigin(0, 0);
this.add.rectangle(game.config.width - borderUISize, 0, borderUISize, game.config.height, 0xFFFFFF).setOrigin(0, 0);
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment