Reset Gulch Map and adjusted up down left right capabilities
This commit is contained in:
parent
e7308aec73
commit
1a9d041cac
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="16" height="9" tilewidth="100" tileheight="100" infinite="1" nextlayerid="7" nextobjectid="56">
|
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="16" height="9" tilewidth="100" tileheight="100" infinite="1" nextlayerid="7" nextobjectid="211">
|
||||||
<editorsettings>
|
<editorsettings>
|
||||||
<export target="../assets/gulch.json" format="json"/>
|
<export target="../assets/gulch.json" format="json"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export class Player extends Phaser.GameObjects.Sprite {
|
||||||
this.isFiring = false;
|
this.isFiring = false;
|
||||||
this.axe;
|
this.axe;
|
||||||
this.bullet;
|
this.bullet;
|
||||||
this.texturePlus = 0;
|
this.texturePlus = 24;
|
||||||
|
|
||||||
// Create animations
|
// Create animations
|
||||||
this.anims.create({
|
this.anims.create({
|
||||||
|
|
@ -45,6 +45,16 @@ export class Player extends Phaser.GameObjects.Sprite {
|
||||||
repeat: -1
|
repeat: -1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.anims.create({
|
||||||
|
key: 'idle',
|
||||||
|
frames: [
|
||||||
|
{ key: 'player-tiles', frame: 0+this.texturePlus }
|
||||||
|
],
|
||||||
|
frameRate: 5,
|
||||||
|
duration: 1500,
|
||||||
|
repeat: -1
|
||||||
|
});
|
||||||
|
|
||||||
this.anims.create({
|
this.anims.create({
|
||||||
key: 'death',
|
key: 'death',
|
||||||
frames: [
|
frames: [
|
||||||
|
|
@ -75,14 +85,31 @@ export class Player extends Phaser.GameObjects.Sprite {
|
||||||
if (this.pauseMove === true) {
|
if (this.pauseMove === true) {
|
||||||
this.body.setVelocity(0);
|
this.body.setVelocity(0);
|
||||||
} else {
|
} else {
|
||||||
|
// Movement: Up/Down:
|
||||||
|
if (this.scene.cursors.up.isDown) {
|
||||||
|
this.body.setVelocityY(-200);
|
||||||
|
this.body.setVelocityX(0);
|
||||||
|
this.anims.play('south', true);
|
||||||
|
this.facing = 'south';
|
||||||
|
} else if (this.scene.cursors.down.isDown) {
|
||||||
|
this.body.setVelocityY(200);
|
||||||
|
this.body.setVelocityX(0);
|
||||||
|
this.anims.play('north', true);
|
||||||
|
this.facing = 'north';
|
||||||
|
} else {
|
||||||
|
this.body.setVelocityY(0);
|
||||||
|
}
|
||||||
|
|
||||||
// Movement: Left/Right:
|
// Movement: Left/Right:
|
||||||
if (this.scene.cursors.left.isDown) {
|
if (this.scene.cursors.left.isDown) {
|
||||||
this.body.setVelocityX(-200);
|
this.body.setVelocityX(-200);
|
||||||
|
this.body.setVelocityY(0);
|
||||||
this.setFlipX(false);
|
this.setFlipX(false);
|
||||||
this.anims.play('side', true);
|
this.anims.play('side', true);
|
||||||
this.facing = 'west';
|
this.facing = 'west';
|
||||||
} else if (this.scene.cursors.right.isDown) {
|
} else if (this.scene.cursors.right.isDown) {
|
||||||
this.body.setVelocityX(200);
|
this.body.setVelocityX(200);
|
||||||
|
this.body.setVelocityY(0);
|
||||||
this.setFlipX(true);
|
this.setFlipX(true);
|
||||||
this.anims.play('side', true);
|
this.anims.play('side', true);
|
||||||
this.facing = 'east';
|
this.facing = 'east';
|
||||||
|
|
@ -90,17 +117,9 @@ export class Player extends Phaser.GameObjects.Sprite {
|
||||||
this.body.setVelocityX(0);
|
this.body.setVelocityX(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Movement: Up/Down:
|
// Idle
|
||||||
if (this.scene.cursors.up.isDown) {
|
if (this.body.velocity.x === 0) {
|
||||||
this.body.setVelocityY(-200);
|
this.anims.play('idle', true);
|
||||||
this.anims.play('south', true);
|
|
||||||
this.facing = 'south';
|
|
||||||
} else if (this.scene.cursors.down.isDown) {
|
|
||||||
this.body.setVelocityY(200);
|
|
||||||
this.anims.play('north', true);
|
|
||||||
this.facing = 'north';
|
|
||||||
} else {
|
|
||||||
this.body.setVelocityY(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ export class Gulch extends Phaser.Scene {
|
||||||
const zoneLayer = gulchMap.getObjectLayer('zone');
|
const zoneLayer = gulchMap.getObjectLayer('zone');
|
||||||
|
|
||||||
// Add a player
|
// Add a player
|
||||||
this.player = new Player(this, 950, 3650);
|
this.player = new Player(this, 950, 4250);
|
||||||
this.player.healthBars(true, 1, 3);
|
this.player.healthBars(true, 1, 3);
|
||||||
|
|
||||||
zoneLayer.objects.forEach(object => {
|
zoneLayer.objects.forEach(object => {
|
||||||
|
|
@ -151,7 +151,7 @@ export class Gulch extends Phaser.Scene {
|
||||||
});
|
});
|
||||||
|
|
||||||
//this.cameras.main.setScroll(800, 1100);
|
//this.cameras.main.setScroll(800, 1100);
|
||||||
this.cameras.main.setBounds(0, 4800, 1600, 900);
|
this.cameras.main.setBounds(0, 3600, 1600, 900);
|
||||||
|
|
||||||
// Background Music
|
// Background Music
|
||||||
this.bgMusic = this.sound.add('gulchMusic', { volume: 0.5 });
|
this.bgMusic = this.sound.add('gulchMusic', { volume: 0.5 });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue