Skip to content

Commit

Permalink
Bug found after leaving the island
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikketer committed Jul 13, 2024
1 parent 239a527 commit e41557f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
4 changes: 2 additions & 2 deletions images.g.jres
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@
"namespace": "mySongs."
},
"song3": {
"data": "0032000408020306001c00010a006400f401640000040000000000000000000000000000000002300000002000012420002400012424002800012228002c0001202c003000011e30003400011d34003800011b38004000011907001c00020a006400f4016400000400000000000000000000000000000000035a0000000400012404000800012208000c0001200c001000012210001400012414001800012518001c0001241c002000012220002400012024002800012228002c0001242c003000012530003800012438003c0001203c004000011d08001c000e050046006603320000040a002d00000064001400013200020100022a0000000400012404000800012208000c0001200c001000011e10001400011d14001800011b18002c000119",
"data": "0032000408020306001c00010a006400f401640000040000000000000000000000000000000002300000002000012420002400012424002800012228002c0001202c003000011e30003400011d34003800011b38004000011907001c00020a006400f4016400000400000000000000000000000000000000035a0000000400012404000800012208000c0001200c001000012210001400012414001800012518001c0001241c002000012220002400012024002800012228002c0001242c003000012530003800012438003c0001203c004000011d08001c000e050046006603320000040a002d00000064001400010000020000022a0000000400012404000800012208000c0001200c001000011e10001400011d14001800011b18002c000119",
"mimeType": "application/mkcd-song",
"displayName": "Game Over",
"namespace": "mySongs."
},
"song2": {
"data": "0078000408050400001c00010a006400f40164000004000000000000000000000000000500000486000000040002192504000c000219250c001000021b2710002000031d20292000240002192524002c000219252c003000021b2730004000021d294000440002192544004c000219254c005000021b2750006000021d296000640002192564006c000219256c007000021b2770008000021d298000880002192588008c000218248c009400021b2703001c0001dc00690000045e01000400000000000000000000056400010400031c0018002000021d2938004000021d2958006000021d2978008000021d2906001c00010a006400f401640000040000000000000000000000000000000002f00000000400011d04000800012408000c00011d0c001000012410001400011d14001800012418001c00011d1c002000012420002400012024002800012728002c0001202c003000012730003400012034003800012738003c0001203c004000012740004400011d44004800012448004c00011d4c005000012450005400011d54005800012458005c00011d5c006000012460006400012064006800012768006c0001206c007000012770007400012074007800012778007c0001207c008000012780008400011d84008800012488008c00011d8c009000012490009400011d94009800012498009c00011d9c00a000012409010e02026400000403780000040a000301000000640001c80000040100000000640001640000040100000000fa0004af00000401c80000040a00019600000414000501006400140005010000002c0104dc00000401fa0000040a0001c8000004140005d0076400140005d0070000c800029001f40105c201f4010a0005900114001400039001000005c201f4010500058403050032000584030000fa00049001000005c201f4010500058403c80032000584030500640005840300009001049001000005c201f4010500058403c80064000584030500c8000584030000f40105ac0d000404a00f00000a0004ac0d2003010004a00f0000280004ac0d9001010004a00f0000280002d00700040408070f0064000408070000c80003c800c8000e7d00c80019000e64000f0032000e78000000fa00032c01c8000ee100c80019000ec8000f0032000edc000000fa0003f401c8000ea901c80019000e90010f0032000ea4010000fa0001c8000004014b000000c800012c01000401c8000000c8000190010004012c010000c80002c800000404c8000f0064000496000000c80002c2010004045e010f006400042c010000640002c409000404c4096400960004f6090000f40102b80b000404b80b64002c0104f40b0000f401022003000004200300040a000420030000ea01029001000004900100040a000490010000900102d007000410d0076400960010d0070000c8007800000001000104080009000106100011000104180019000106200021000104280029000106300031000104380039000106400041000104480049000106500051000104580059000106600061000104680069000106700071000104780079000106800081000104880089000106900091000104980099000106",
"data": "0078000408050400001c00010a006400f40164000004000000000000000000000000000500000486000000040002192504000c000219250c001000021b2710002000031d20292000240002192524002c000219252c003000021b2730004000021d294000440002192544004c000219254c005000021b2750006000021d296000640002192564006c000219256c007000021b2770008000021d298000880002192588008c000218248c009400021b2703001c0001dc00690000045e01000400000000000000000000050000010000031c0018002000021d2938004000021d2958006000021d2978008000021d2906001c00010a006400f401640000040000000000000000000000000000000002f00000000400011d04000800012408000c00011d0c001000012410001400011d14001800012418001c00011d1c002000012420002400012024002800012728002c0001202c003000012730003400012034003800012738003c0001203c004000012740004400011d44004800012448004c00011d4c005000012450005400011d54005800012458005c00011d5c006000012460006400012064006800012768006c0001206c007000012770007400012074007800012778007c0001207c008000012780008400011d84008800012488008c00011d8c009000012490009400011d94009800012498009c00011d9c00a000012409010e02026400000403780000040a000301000000640001c80000040100000000640001640000040100000000fa0004af00000401c80000040a00019600000414000501006400140005010000002c0104dc00000401fa0000040a0001c8000004140005d0076400140005d0070000c800029001f40105c201f4010a0005900114001400039001000005c201f4010500058403050032000584030000fa00049001000005c201f4010500058403c80032000584030500640005840300009001049001000005c201f4010500058403c80064000584030500c8000584030000f40105ac0d000404a00f00000a0004ac0d2003010004a00f0000280004ac0d9001010004a00f0000280002d00700040408070f0064000408070000c80003c800c8000e7d00c80019000e64000f0032000e78000000fa00032c01c8000ee100c80019000ec8000f0032000edc000000fa0003f401c8000ea901c80019000e90010f0032000ea4010000fa0001c8000004014b000000c800012c01000401c8000000c8000190010004012c010000c80002c800000404c8000f0064000496000000c80002c2010004045e010f006400042c010000640002c409000404c4096400960004f6090000f40102b80b000404b80b64002c0104f40b0000f401022003000004200300040a000420030000ea01029001000004900100040a000490010000900102d007000410d0076400960010d0070000c8007800000001000104080009000106100011000104180019000106200021000104280029000106300031000104380039000106400041000104480049000106500051000104580059000106600061000104680069000106700071000104780079000106800081000104880089000106900091000104980099000106",
"mimeType": "application/mkcd-song",
"displayName": "We Boat",
"namespace": "mySongs."
Expand Down
4 changes: 2 additions & 2 deletions images.g.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1164,9 +1164,9 @@ d d b f f f e e d . . . . . . .
case "song1":
case "mySong":return hex`0078000408050206001c00010a006400f401640000040000000000000000000000000000000002d20000000400012a04000800012908000c00012a0c001000012c10001400012a14001800012918001c00012a1c002000012c20002800012a28002c0001272c003000012930003400012a34003800012738003c0001293c004000012540004400012a44004800012c48004c00012a4c005000012950005400012a54005800012c58005c00012a5c006000012960006400012a64006800012c68007000012a70007400012c74007800012a78007c0001277c008000012c80008400012a84008800012c88008c00012a8c00900001299000a000012707001c00020a006400f401640000040000000000000000000000000000000003f00000000400012204000800012208000c0001220c001000011b10001400011d14001800012218001c0001221c002000012220002400011b24002800011d28002c0001222c003000012230003400012234003800011b38003c00011d3c004000012240004400012244004800012248004c00011b4c005000011d50005400011954005800011958005c0001195c006000011d60006400011e64006800011968006c0001196c007000011970007400011d74007800011e78007c0001197c008000011980008400011984008800011d88008c00011e8c009000012490009400012494009800012498009c0001259c00a0000127`;
case "song3":
case "Game Over":return hex`0032000408020306001c00010a006400f401640000040000000000000000000000000000000002300000002000012420002400012424002800012228002c0001202c003000011e30003400011d34003800011b38004000011907001c00020a006400f4016400000400000000000000000000000000000000035a0000000400012404000800012208000c0001200c001000012210001400012414001800012518001c0001241c002000012220002400012024002800012228002c0001242c003000012530003800012438003c0001203c004000011d08001c000e050046006603320000040a002d00000064001400013200020100022a0000000400012404000800012208000c0001200c001000011e10001400011d14001800011b18002c000119`;
case "Game Over":return hex`0032000408020306001c00010a006400f401640000040000000000000000000000000000000002300000002000012420002400012424002800012228002c0001202c003000011e30003400011d34003800011b38004000011907001c00020a006400f4016400000400000000000000000000000000000000035a0000000400012404000800012208000c0001200c001000012210001400012414001800012518001c0001241c002000012220002400012024002800012228002c0001242c003000012530003800012438003c0001203c004000011d08001c000e050046006603320000040a002d00000064001400010000020000022a0000000400012404000800012208000c0001200c001000011e10001400011d14001800011b18002c000119`;
case "song2":
case "We Boat":return hex`0078000408050400001c00010a006400f40164000004000000000000000000000000000500000486000000040002192504000c000219250c001000021b2710002000031d20292000240002192524002c000219252c003000021b2730004000021d294000440002192544004c000219254c005000021b2750006000021d296000640002192564006c000219256c007000021b2770008000021d298000880002192588008c000218248c009400021b2703001c0001dc00690000045e01000400000000000000000000056400010400031c0018002000021d2938004000021d2958006000021d2978008000021d2906001c00010a006400f401640000040000000000000000000000000000000002f00000000400011d04000800012408000c00011d0c001000012410001400011d14001800012418001c00011d1c002000012420002400012024002800012728002c0001202c003000012730003400012034003800012738003c0001203c004000012740004400011d44004800012448004c00011d4c005000012450005400011d54005800012458005c00011d5c006000012460006400012064006800012768006c0001206c007000012770007400012074007800012778007c0001207c008000012780008400011d84008800012488008c00011d8c009000012490009400011d94009800012498009c00011d9c00a000012409010e02026400000403780000040a000301000000640001c80000040100000000640001640000040100000000fa0004af00000401c80000040a00019600000414000501006400140005010000002c0104dc00000401fa0000040a0001c8000004140005d0076400140005d0070000c800029001f40105c201f4010a0005900114001400039001000005c201f4010500058403050032000584030000fa00049001000005c201f4010500058403c80032000584030500640005840300009001049001000005c201f4010500058403c80064000584030500c8000584030000f40105ac0d000404a00f00000a0004ac0d2003010004a00f0000280004ac0d9001010004a00f0000280002d00700040408070f0064000408070000c80003c800c8000e7d00c80019000e64000f0032000e78000000fa00032c01c8000ee100c80019000ec8000f0032000edc000000fa0003f401c8000ea901c80019000e90010f0032000ea4010000fa0001c8000004014b000000c800012c01000401c8000000c8000190010004012c010000c80002c800000404c8000f0064000496000000c80002c2010004045e010f006400042c010000640002c409000404c4096400960004f6090000f40102b80b000404b80b64002c0104f40b0000f401022003000004200300040a000420030000ea01029001000004900100040a000490010000900102d007000410d0076400960010d0070000c8007800000001000104080009000106100011000104180019000106200021000104280029000106300031000104380039000106400041000104480049000106500051000104580059000106600061000104680069000106700071000104780079000106800081000104880089000106900091000104980099000106`;
case "We Boat":return hex`0078000408050400001c00010a006400f40164000004000000000000000000000000000500000486000000040002192504000c000219250c001000021b2710002000031d20292000240002192524002c000219252c003000021b2730004000021d294000440002192544004c000219254c005000021b2750006000021d296000640002192564006c000219256c007000021b2770008000021d298000880002192588008c000218248c009400021b2703001c0001dc00690000045e01000400000000000000000000050000010000031c0018002000021d2938004000021d2958006000021d2978008000021d2906001c00010a006400f401640000040000000000000000000000000000000002f00000000400011d04000800012408000c00011d0c001000012410001400011d14001800012418001c00011d1c002000012420002400012024002800012728002c0001202c003000012730003400012034003800012738003c0001203c004000012740004400011d44004800012448004c00011d4c005000012450005400011d54005800012458005c00011d5c006000012460006400012064006800012768006c0001206c007000012770007400012074007800012778007c0001207c008000012780008400011d84008800012488008c00011d8c009000012490009400011d94009800012498009c00011d9c00a000012409010e02026400000403780000040a000301000000640001c80000040100000000640001640000040100000000fa0004af00000401c80000040a00019600000414000501006400140005010000002c0104dc00000401fa0000040a0001c8000004140005d0076400140005d0070000c800029001f40105c201f4010a0005900114001400039001000005c201f4010500058403050032000584030000fa00049001000005c201f4010500058403c80032000584030500640005840300009001049001000005c201f4010500058403c80064000584030500c8000584030000f40105ac0d000404a00f00000a0004ac0d2003010004a00f0000280004ac0d9001010004a00f0000280002d00700040408070f0064000408070000c80003c800c8000e7d00c80019000e64000f0032000e78000000fa00032c01c8000ee100c80019000ec8000f0032000edc000000fa0003f401c8000ea901c80019000e90010f0032000ea4010000fa0001c8000004014b000000c800012c01000401c8000000c8000190010004012c010000c80002c800000404c8000f0064000496000000c80002c2010004045e010f006400042c010000640002c409000404c4096400960004f6090000f40102b80b000404b80b64002c0104f40b0000f401022003000004200300040a000420030000ea01029001000004900100040a000490010000900102d007000410d0076400960010d0070000c8007800000001000104080009000106100011000104180019000106200021000104280029000106300031000104380039000106400041000104480049000106500051000104580059000106600061000104680069000106700071000104780079000106800081000104880089000106900091000104980099000106`;
}
return null;
})
Expand Down
43 changes: 42 additions & 1 deletion island.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace Island {
const treasureImage: Image = assets.image`Chest`
const openTreasureAnimation: Image[] = assets.animation`Chest Open`

let player1: Pirate
let player2: Pirate
let currentEnemies: Array<Militia> = []
Expand All @@ -12,13 +15,20 @@ namespace Island {
let _island: Map.Island
let _onLeaveIsland: () => void
let _dirtSpeckles: Sprite[] = []
let _treasureSprite: Sprite

function onPirateAttack({ pirate, direction }: { pirate: Pirate, direction: 'left' | 'right' }) {
const dirPix = direction === 'left' ? -1 : 1
// The hit zone is the pirate "sword" box: [center, right|left] and [top, bottom]
const hitXZone = [pirate.sprite.x, pirate.sprite.x + (13 * dirPix)]
// The sword is only near the top of the sprite, we don't kill with feet
const hitYZone = [pirate.sprite.y - 4, pirate.sprite.y + 2]

// Check to see if we slashed the treasure!
if (_treasureSprite) {
openTreasure()
return
}

// manually check each enemy to see if they overlap, also check for parry
currentEnemies.forEach((enemy) => {
Expand Down Expand Up @@ -55,12 +65,15 @@ namespace Island {
// Tiny delay to show the arrow, cuz... TMNT
setTimeout(() => {
// Recheck if complete just in case we walked before this appeared
if (isSegmentComplete) {
if (isSegmentComplete && _island) {
arrow = sprites.create(assets.image`Arrow`)
arrow.x = 140
arrow.y = 80
}
}, 1500)
} else {
// We completed the last segment!
showTreasure()
}
}
}
Expand Down Expand Up @@ -100,6 +113,28 @@ namespace Island {
})
}

function showTreasure() {
_treasureSprite = sprites.create(treasureImage)
const randX = Math.randomRange(_boundingBox[0] + 20, _boundingBox[2] - 15)
const randY = Math.randomRange(_boundingBox[1] + 50, _boundingBox[3] - 15)
_treasureSprite.x = randX
_treasureSprite.y = randY
_treasureSprite.z = randY
}

function openTreasure() {
animation.runImageAnimation(
_treasureSprite,
openTreasureAnimation,
200,
false
)
setTimeout(() => {
// Exit the island after the animation!
leaveIsland()
}, openTreasureAnimation.length * 200 + 500)
}

function placeEnemies() {
// The number of enemies is based on the risk level of the island
// number of players AND segment level
Expand All @@ -114,12 +149,18 @@ namespace Island {
}

function leaveIsland() {
_island = undefined

player1.destroy()
player2.destroy()

currentEnemies.map(enemy => enemy.destory())
currentEnemies = []

if (_treasureSprite) {
_treasureSprite.destroy()
}

// Remove all listeners and clear the screen
controller.player1.B.removeEventListener(ControllerButtonEvent.Pressed, leaveIsland)

Expand Down
5 changes: 2 additions & 3 deletions militia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Militia {
static attackRightAnimation: Image[] = assets.animation`Militia Shoot`
static attackLeftAnimation: Image[] = Utils.flipAnimation(assets.animation`Militia Shoot`)
static parrySound: music.SoundEffect = music.createSoundEffect(WaveShape.Noise, 5000, 5000, 255, 0, 100, SoundExpressionEffect.Vibrato, InterpolationCurve.Curve)

static speed: number = 10
static directionChangeInterval: number = 1000
static attackDelayMin: number = 4000
Expand Down Expand Up @@ -120,9 +121,7 @@ class Militia {
setTimeout(() => {
// bigCrash or sonar....
music.play(music.melodyPlayable(music.bigCrash), music.PlaybackMode.InBackground)
// music.play(music.melodyPlayable(music.sonar), music.playSound)
// music.createSoundEffect(WaveShape.Sawtooth, 500, 500, 100, 0, 1000, SoundExpressionEffect.None, InterpolationCurve.Linear)
// music.playSound('1 1 1')

// Check to see that our target is in range and fire the hit
if (Math.abs(this.sprite.y - this.currentTarget.sprite.y) < 30) {
this.currentTarget.hit(this, 1)
Expand Down

0 comments on commit e41557f

Please sign in to comment.