Skip to content

Commit

Permalink
Riches!
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikketer committed Jul 16, 2024
1 parent 12c751b commit 836bea6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
4 changes: 3 additions & 1 deletion enemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ class Enemy {
protected _isAttacking: boolean = false
protected _lastDirectionTick: number = 0

constructor({ x, y, target, sprite }: { x: number, y: number, target: Pirate, sprite: Sprite }) {
constructor({ x, y, target, sprite, riches }: { x: number, y: number, target: Pirate, sprite: Sprite, riches?: number }) {
this.sprite = sprite
this.sprite.x = x
this.sprite.y = y

this.riches = riches != null ? riches : 1

// On initial spawn they are quick to attack!
this._nextAttackTime = Math.randomRange(Militia.attackDelayMin / 2, Militia.attackDelayMax / 2)
this._lastAttackTick = control.millis()
Expand Down
10 changes: 5 additions & 5 deletions images.g.jres
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
"mimeType": "image/x-mkcd-f4",
"displayName": "Boat Icon"
},
"image11": {
"data": "hwQIAAgAAAAAAAAA4ADu7u7d7e7u3e3u7t3u7uDd7u7gAO4OAAAAAA==",
"mimeType": "image/x-mkcd-f4",
"displayName": "Pocket Icon"
},
"image14": {
"data": "hwQIAAgAAAAAVUUAUFVVBFBVVQRQVVUEUFVVBFBVVQRQVVUEAFVFAA==",
"mimeType": "image/x-mkcd-f4",
Expand Down Expand Up @@ -84,6 +79,11 @@
"mimeType": "image/x-mkcd-f4",
"displayName": "Militia Broken and Broke Left"
},
"image11": {
"data": "hwQIAAgAAAAAAAAAAFAFAABRVQAQVVUEUFVVBABVRQAAQAQAAAAAAA==",
"mimeType": "image/x-mkcd-f4",
"displayName": "Pocket Icon"
},
"anim14": {
"namespace": "myAnimations",
"id": "anim14",
Expand Down
22 changes: 11 additions & 11 deletions images.g.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,6 @@ e e e e e e e e
. e e e e e e e
. . e e e e e e
. . . . . . . .
`;
case "image11":
case "Pocket Icon":return img`
. . e e e . . .
. e e e e e e .
. . d d d d . .
. . d d d d . .
. e d d e e e .
. e e e e e e .
. e e e e e e .
. e e e e e . .
`;
case "image14":
case "Coin":return img`
Expand Down Expand Up @@ -514,6 +503,17 @@ d d a a a c c d d . . . . . . .
. . . f e e a a d d d d a . . f
. . . f e e c c a a a a c d d f
. . . f e e c a a a a a a d d f
`;
case "image11":
case "Pocket Icon":return img`
. . . . . . . .
. . . 1 5 . . .
. . 1 5 5 5 . .
. 5 5 5 5 5 4 .
. 5 5 5 5 5 4 .
. . 5 5 5 4 . .
. . . 4 4 . . .
. . . . . . . .
`;
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion island.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ namespace Island {
if (player2.health > 0) livingPirates.push(player2)
const randomTarget = Math.pickRandom(livingPirates)

currentEnemies.push(new Militia({ x: locX, y: locY, target: randomTarget }))
currentEnemies.push(new Militia({ x: locX, y: locY, target: randomTarget, riches: 1 + currentSegment }))
})

Utils.getArrayOfLength(Math.randomRange(1, 3)).forEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions militia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Militia extends Enemy {
static attackDelayMin: number = 4000
static attackDelayMax: number = 6000

constructor({ x, y, target }: { x: number, y: number, target?: Pirate }) {
super({ x, y, target, sprite: sprites.create(assets.animation`Militia Walk`[0]) })
constructor({ x, y, target, riches }: { x: number, y: number, target?: Pirate, riches?: number }) {
super({ x, y, target, sprite: sprites.create(assets.animation`Militia Walk`[0]), riches })

// Most often we spawn to the right, so walk left
this.walk('left')
Expand Down

0 comments on commit 836bea6

Please sign in to comment.