Skip to content

Commit

Permalink
Add Phase tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
Nereare committed Nov 6, 2024
1 parent 525fd26 commit aaac50b
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 0 deletions.
Binary file added assets/bomb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/dude.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/platform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sky.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>Minesdeep</title>
<link rel="stylesheet" href="node_modules/normalize.css/normalize.css">
<script src="node_modules/phaser/dist/phaser.min.js"></script>
</head>

<body>
<script src="index.js" type="module"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { MainScene } from "./src/MainScene";

// font size
const FONT = 32;
// map dimensions
const ROWS = 20;
const COLS = 20;
// number of actors per level, including player
const ACTORS = 10;

const CONFIG = {
type: Phaser.AUTO,
width: COLS * FONT * 0.6,
height: ROWS * FONT,
backgroundColor: "#0a0a0a",
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH
},
scene: [ MainScene ]
};

var game = new Phaser.Game(CONFIG);

// https://code.tutsplus.com/how-to-make-your-first-roguelike--gamedev-13677t
27 changes: 27 additions & 0 deletions src/MainScene.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export class MainScene extends Phaser.Scene {
cursors;

constructor() {
super({ key: "MainScene" });
}

preload() {
//
}

create() {
this.cursors = this.input.keyboard.createCursorKeys();
}

update(time) {
if (this.cursors.left.isDown) {
//
} else if (this.cursors.up.isDown) {
//
} else if (this.cursors.right.isDown) {
//
} else if (this.cursors.down.isDown) {
//
}
}
}

0 comments on commit aaac50b

Please sign in to comment.