Throw bullets about

This commit is contained in:
oliverbye committed 2018-11-17 15:02:43 +00:00
1 parent cff4d5d2ec
commit 5d9387b74a
2 files changed
+6

No files matched your search

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

+6
View File
@@ -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);
}
}