mirror of
https://github.com/bdnugget/castrax.git
synced 2026-11-07 04:47:27 +00:00
Throw bullets about
This commit is contained in:
1 parent
cff4d5d2ec
commit
5d9387b74a
2 files changed
+6
No files matched your search
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 372 B |
@@ -5,6 +5,7 @@ class Field extends Phaser.Scene {
|
||||
|
||||
preload() {
|
||||
this.load.image('TankFR1', 'assets/tank2fr1.png');
|
||||
this.load.image('Bullet', 'assets/Bullet.png');
|
||||
}
|
||||
create() {
|
||||
this.image = this.add.image(400,300,'TankFR1');
|
||||
@@ -12,5 +13,10 @@ class Field extends Phaser.Scene {
|
||||
this.input.keyboard.on('keyup_D', function (event) {
|
||||
this.image.x +=10;
|
||||
}, this);
|
||||
|
||||
this.input.keyboard.on('keyup_P', function () {
|
||||
var pi = this.physics.add.image(this.image.x, this.image.y, 'Bullet')
|
||||
pi.setVelocity(Phaser.Math.RND.integerInRange(-100,100), -300);
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user