mirror of
https://github.com/bdnugget/castrax.git
synced 2026-11-07 04:47:27 +00:00
Simple Phaser tank
This commit is contained in:
1 parent
710ec3590b
commit
cff4d5d2ec
5 files changed
+170345
No files matched your search
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,16 @@
|
||||
class Field extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({key:"Field"});
|
||||
}
|
||||
|
||||
preload() {
|
||||
this.load.image('TankFR1', 'assets/tank2fr1.png');
|
||||
}
|
||||
create() {
|
||||
this.image = this.add.image(400,300,'TankFR1');
|
||||
|
||||
this.input.keyboard.on('keyup_D', function (event) {
|
||||
this.image.x +=10;
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
var config = {
|
||||
type:Phaser.AUTO,
|
||||
width: 800,
|
||||
height: 600,
|
||||
physics: {
|
||||
default:'arcade',
|
||||
arcade: {
|
||||
gravity: {y:200}
|
||||
}
|
||||
},
|
||||
scene: [Field]
|
||||
};
|
||||
|
||||
var game = new Phaser.Game(config);
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CastTrax</title>
|
||||
<script src="phaser.js"></script>
|
||||
<script src="field.js"></script>
|
||||
<script src="game.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user