FISH GAME
https://makecode.com/_cAaidV0fe9Xh
namespace SpriteKind {
export const FISH_BIG = SpriteKind.create()
export const FISH_SMALL = SpriteKind.create()
}
function moveShark () {
if (controller.left.isPressed()) {
mySprite.x += -3
shark_dir = -1
animation.runImageAnimation(
mySprite,
[img`
.............ccfff..............
...........ccddbcf..............
..........ccddbbf...............
..........fccbbcf...............
.....fffffccccccff.........ccc..
...ffbbbbbbbcbbbbcfff....ccbbc..
..fbbbbbbbbcbcbbbbcccff.cdbbc...
ffbbbbbbffbbcbcbbbcccccfcdbbf...
fbcbbb11ff1bcbbbbbcccccffbbf....
fbbb11111111bbbbbcccccccbbcf....
.fb11133cc11bbbbcccccccccccf....
..fccc31c111bbbcccccbdbffbbcf...
...fc13c111cbbbfcddddcc..fbbf...
....fccc111fbdbbccdcc.....fbbf..
........ccccfcdbbcc........fff..
.............fffff..............
`,img`
.............ccfff..............
............cddbbf..............
...........cddbbf...............
..........fccbbcf............ccc
....ffffffccccccff.........ccbbc
..ffbbbbbbbbbbbbbcfff.....cdbbc.
ffbbbbbbbbbcbcbbbbcccff..cddbbf.
fbcbbbbbffbbcbcbbbcccccfffdbbf..
fbbb1111ff1bcbcbbbcccccccbbbcf..
.fb11111111bbbbbbcccccccccbccf..
..fccc33cc11bbbbccccccccfffbbcf.
...fc131c111bbbcccccbdbc...fbbf.
....f33c111cbbbfdddddcc.....fbbf
.....ff1111fbdbbfddcc........fff
.......cccccfbdbbfc.............
.............fffff..............
`,img`
..............cfff..............
............ccddbf..............
...........cbddbff.........ccc..
..........fccbbcf.........cbbc..
...fffffffccccccff.......cdbc...
.ffcbbbbbbbbbbbbbcfff....cdbf...
fcbbbbbbbbbcbbbbbbcccff.cdbf....
fbcbbbbffbbbcbcbbbcccccffdcf....
fbb1111ffbbbcbcbbbccccccbbcf....
.fb11111111bbcbbbccccccccbbcf...
..fccc33cb11bbbbcccccccfffbbf...
...fc131c111bbbcccccbdbc..fbbf..
....f33c111cbbccdddddbc....fff..
.....ff1111fdbbccddbcc..........
.......cccccfdbbbfcc............
.............fffff..............
`,img`
.............ccfff..............
............cddbbf..............
...........cddbbf...............
..........fccbbcf............ccc
....ffffffccccccff.........ccbbc
..ffbbbbbbbbbbbbbcfff.....cdbbc.
ffbbbbbbbbbcbcbbbbcccff..cddbbf.
fbcbbbbbffbbcbcbbbcccccfffdbbf..
fbbb1111ff1bcbcbbbcccccccbbbcf..
.fb11111111bbbbbbcccccccccbccf..
..fccc33cc11bbbbccccccccfffbbcf.
...fc131c111bbbcccccbdbc...fbbf.
....f33c111cbbbfdddddcc.....fbbf
.....ff1111fbdbbfddcc........fff
.......cccccfbdbbfc.............
.............fffff..............
`],
200,
true
)
}
if (controller.right.isPressed()) {
mySprite.x += 3
shark_dir = 1
animation.runImageAnimation(
mySprite,
[img`
..............fffcc.............
..............fcbddcc...........
...............fbbddcc..........
...............fcbbccf..........
..ccc.........ffccccccfffff.....
..cbbcc....fffcbbbbcbbbbbbbff...
...cbbdc.ffcccbbbbcbcbbbbbbbbf..
...fbbdcfcccccbbbcbcbbffbbbbbbff
....fbbffcccccbbbbbcb1ff11bbbcbf
....fcbbcccccccbbbbb11111111bbbf
....fcccccccccccbbbb11cc33111bf.
...fcbbffbdbcccccbbb111c13cccf..
...fbbf..ccddddcfbbbc111c31cf...
..fbbf.....ccdccbbdbf111cccf....
..fff........ccbbdcfcccc........
..............fffff.............
`,img`
..............fffcc.............
..............fbbddc............
...............fbbddc...........
ccc............fcbbccf..........
cbbcc.........ffccccccffffff....
.cbbdc.....fffcbbbbbbbbbbbbbff..
.fbbddc..ffcccbbbbcbcbbbbbbbbbff
..fbbdfffcccccbbbcbcbbffbbbbbcbf
..fcbbbcccccccbbbcbcb1ff1111bbbf
..fccbcccccccccbbbbbb11111111bf.
.fcbbfffccccccccbbbb11cc33cccf..
.fbbf...cbdbcccccbbb111c131cf...
fbbf.....ccdddddfbbbc111c33f....
fff........ccddfbbdbf1111ff.....
.............cfbbdbfccccc.......
..............fffff.............
`,img`
..............fffc..............
..............fbddcc............
..ccc.........ffbddbc...........
..cbbc.........fcbbccf..........
...cbdc.......ffccccccfffffff...
...fbdc....fffcbbbbbbbbbbbbbcff.
....fbdc.ffcccbbbbbbcbbbbbbbbbcf
....fcdffcccccbbbcbcbbbffbbbbcbf
....fcbbccccccbbbcbcbbbff1111bbf
...fcbbccccccccbbbcbb11111111bf.
...fbbfffcccccccbbbb11bc33cccf..
..fbbf..cbdbcccccbbb111c131cf...
..fff....cbdddddccbbc111c33f....
..........ccbddccbbdf1111ff.....
............ccfbbbdfccccc.......
..............fffff.............
`,img`
..............fffcc.............
..............fbbddc............
...............fbbddc...........
ccc............fcbbccf..........
cbbcc.........ffccccccffffff....
.cbbdc.....fffcbbbbbbbbbbbbbff..
.fbbddc..ffcccbbbbcbcbbbbbbbbbff
..fbbdfffcccccbbbcbcbbffbbbbbcbf
..fcbbbcccccccbbbcbcb1ff1111bbbf
..fccbcccccccccbbbbbb11111111bf.
.fcbbfffccccccccbbbb11cc33cccf..
.fbbf...cbdbcccccbbb111c131cf...
fbbf.....ccdddddfbbbc111c33f....
fff........ccddfbbdbf1111ff.....
.............cfbbdbfccccc.......
..............fffff.............
`],
200,
true
)
}
if (controller.up.isPressed()) {
mySprite.y += -3
}
if (controller.down.isPressed()) {
mySprite.y += 3
}
if (controller.A.isPressed()) {
if (shark_dir == -1) {
animation.runImageAnimation(
mySprite,
[img`
.................ccfff..............
................cddbbf..............
...............cddbbf...............
..............fccbbcf............ccc
........ffffffccccccff.........ccbbc
......ffbbbbbbbbbbbbbcfff.....cdbbc.
....ffbbbbbbbbbcbcbbbbcccff..cddbbf.
....fbcbbbbbffbbcbcbbbcccccfffdbbf..
....fbbb1111ff1bcbcbbbcccccccbbbcf..
.....fb11111111bbbbbbcccccccccbccf..
......fccc33cc11bbbbccccccccfffbbcf.
.......fc131c111bbbcccccbdbc...fbbf.
........f33c111cbbbfdddddcc.....fbbf
.........ff1111fbdbbfddcc........fff
...........cccccfbdbbfc.............
.................fffff..............
`,img`
.................ccfff..............
................cddbbf..............
...............cddbbf...............
.........ffffffccbbcf...............
......fffbbbbbbbbcccff..............
.....fbbbbbbbbbbbbbbbcfff......ccccc
.....bcbbbbbffbcbcbbbbcccff...cdbbbc
.....bbb1111ffbbcbcbbbcccccffcddbbc.
.....fb11111111bcbcbbbcccccccbdbbf..
......fccc33c11bbbbbbcccccccccbbcf..
.......fc131cc11bbbbccccccccffbccf..
........f33c1111bbbcccccbdbc..fbbcf.
.........ff1111cbbbfdddddcc....fbbf.
...........ccc1fbdbbfddcc.......fbbf
..............ccfbdbbfc..........fff
.................fffff..............
`,img`
..................ccfff.............
.................cddbbf.............
........fffffffffddbbf..............
.......fbbbbbbbbbfcbcf..............
.......fbbc111bffbbccffff...........
.......fb111111ffbbbbbcccff....ccccc
........f1cc3311bbcbcbbccccf..cdbbbc
........fcc131c1bbbcbcbcccccfcddbbc.
.........f111111bbbcbcbccccccbdbbf..
.........f1111111bbbbbccccccccbbcf..
..........f111111bbbbcccccccffbccf..
...........c1111cbbbcccccbdbc.fbbcf.
............cc11cbbbfddddddc...fbbf.
..............cffbdbbfdddcc.....fbbf
.................fbdbbfcc........fff
..................fffff.............
`,img`
....................ccfff...........
..........fffffffffcbbbbf...........
.........fbbbbbbbbbfffbf............
.........fbb111bffbbbbff............
.........fb11111ffbbbbbcff..........
.........f1cccc11bbcbcbcccf.........
..........fc1c1c1bbbcbcbcccf...ccccc
............c3331bbbcbcbccccfccddbbc
...........c333c1bbbbbbbcccccbddbcc.
...........c331c11bbbbbcccccccbbcc..
..........cc13c111bbbbccccccffbccf..
..........c111111cbbbcccccbbc.fccf..
...........cc1111cbbbfdddddc..fbbcf.
.............cccffbdbbfdddc....fbbf.
..................fbdbbfcc......fbbf
...................fffff.........fff
`,img`
...........fffffff...ccfff..........
..........fbbbbbbbffcbbbbf..........
..........fbb111bbbbbffbf...........
..........fb11111ffbbbbff...........
..........f1cccc1ffbbbbbcff.........
..........ffc1c1c1bbcbcbcccf........
...........fcc3331bbbcbcbcccf..ccccc
............c333c1bbbcbcbccccfcddbbc
............c333c1bbbbbbbcccccddbcc.
............c333c11bbbbbccccccbbcc..
...........cc331c11bbbbccccccfbccf..
...........cc13c11cbbbcccccbbcfccf..
...........c111111cbbbfdddddc.fbbcf.
............cc1111fbdbbfdddc...fbbf.
..............cccfffbdbbfcc.....fbbf
....................fffff........fff
`,img`
....................................
....................................
....................................
...............ccffff...............
..............cddbbbf...............
.......ffffffcddbbbf................
.....ffbbbbbbbbbbbbbcfff.......ccccc
...ffbbbbbbbbcbcbbbbbcccff....cdbbbc
..fbbbbbbbbbbcbbcbbbbcccccfffcddbbc.
.fbcbbbbbbbbbbcbcbbbbccccccccbdbbf..
.fbbbbbbbfffbbcbbbbbccccccccccbbcf..
.ffbb1111fffbbcbbbbcccccccbcffbccf..
..ff111111111bbbbccccccbbbcc..fbbcf.
....ccccccc111bdbbbfddbccc.....ffbbf
........ccccccfbdbbbfcc..........fff
...............ffffff...............
`],
100,
false
)
} else {
animation.runImageAnimation(
mySprite,
[img`
..............fffcc.................
..............fbbddc................
...............fbbddc...............
ccc............fcbbccf..............
cbbcc.........ffccccccffffff........
.cbbdc.....fffcbbbbbbbbbbbbbff......
.fbbddc..ffcccbbbbcbcbbbbbbbbbff....
..fbbdfffcccccbbbcbcbbffbbbbbcbf....
..fcbbbcccccccbbbcbcb1ff1111bbbf....
..fccbcccccccccbbbbbb11111111bf.....
.fcbbfffccccccccbbbb11cc33cccf......
.fbbf...cbdbcccccbbb111c131cf.......
fbbf.....ccdddddfbbbc111c33f........
fff........ccddfbbdbf1111ff.........
.............cfbbdbfccccc...........
..............fffff.................
`,img`
..............fffcc.................
..............fbbddc................
...............fbbddc...............
...............fcbbccffffff.........
..............ffcccbbbbbbbbfff......
ccccc......fffcbbbbbbbbbbbbbbbf.....
cbbbdc...ffcccbbbbcbcbffbbbbbcb.....
.cbbddcffcccccbbbcbcbbff1111bbb.....
..fbbdbcccccccbbbcbcb11111111bf.....
..fcbbcccccccccbbbbbb11c33cccf......
..fccbffccccccccbbbb11cc131cf.......
.fcbbf..cbdbcccccbbb1111c33f........
.fbbf....ccdddddfbbbc1111ff.........
fbbf.......ccddfbbdbf1ccc...........
fff..........cfbbdbfcc..............
..............fffff.................
`,img`
.............fffcc..................
.............fbbddc.................
..............fbbddfffffffff........
..............fcbcfbbbbbbbbbf.......
...........ffffccbbffb111cbbf.......
ccccc....ffcccbbbbbff111111bf.......
cbbbdc..fccccbbcbcbb1133cc1f........
.cbbddcfcccccbcbcbbb1c131ccf........
..fbbdbccccccbcbcbbb111111f.........
..fcbbccccccccbbbbb1111111f.........
..fccbffcccccccbbbb111111f..........
.fcbbf.cbdbcccccbbbc1111c...........
.fbbf...cddddddfbbbc11cc............
fbbf.....ccdddfbbdbffc..............
fff........ccfbbdbf.................
.............fffff..................
`,img`
...........fffcc....................
...........fbbbbcfffffffff..........
............fbfffbbbbbbbbbf.........
............ffbbbbffb111bbf.........
..........ffcbbbbbff11111bf.........
.........fcccbcbcbb11cccc1f.........
ccccc...fcccbcbcbbb1c1c1cf..........
cbbddccfccccbcbcbbb1333c............
.ccbddbcccccbbbbbbb1c333c...........
..ccbbcccccccbbbbb11c133c...........
..fccbffccccccbbbb111c31cc..........
..fccf.cbbcccccbbbc111111c..........
.fcbbf..cdddddfbbbc1111cc...........
.fbbf....cdddfbbdbffccc.............
fbbf......ccfbbdbf..................
fff.........fffff...................
`,img`
..........fffcc...fffffff...........
..........fbbbbcffbbbbbbbf..........
...........fbffbbbbb111bbf..........
...........ffbbbbff11111bf..........
.........ffcbbbbbff1cccc1f..........
........fcccbcbcbb1c1c1cff..........
ccccc..fcccbcbcbbb1333ccf...........
cbbddcfccccbcbcbbb1c333c............
.ccbddcccccbbbbbbb1c333c............
..ccbbccccccbbbbb11c333c............
..fccbfccccccbbbb11c133cc...........
..fccfcbbcccccbbbc11c31cc...........
.fcbbf.cdddddfbbbc111111c...........
.fbbf...cdddfbbdbf1111cc............
fbbf.....ccfbbdbfffccc..............
fff........fffff....................
`,img`
....................................
....................................
....................................
...............ffffcc...............
...............fbbbddc..............
................fbbbddcffffff.......
ccccc.......fffcbbbbbbbbbbbbbff.....
cbbbdc....ffcccbbbbbcbcbbbbbbbbff...
.cbbddcfffcccccbbbbcbbcbbbbbbbbbbf..
..fbbdbccccccccbbbbcbcbbbbbbbbbbcbf.
..fcbbccccccccccbbbbbcbbfffbbbbbbbf.
..fccbffcbcccccccbbbbcbbfff1111bbff.
.fcbbf..ccbbbccccccbbbb111111111ff..
fbbff.....cccbddfbbbdb111ccccccc....
fff..........ccfbbbdbfcccccc........
...............ffffff...............
`],
100,
false
)
}
}
}
controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
})
info.onCountdownEnd(function () {
game.over(true)
})
function 生大魚 (num: number) {
for (let index = 0; index < num; index++) {
fish_big = sprites.create(img`
....................
....................
....................
.....fffffff........
....ff88888ff.....ff
..fff8888888ff....f8
..f8888188888ff..ff8
.ff1f1111118888fff1f
ff1ff1111111188881ff
f11111111111111111f.
fff111111111111911ff
..fff999111119ffff11
....ff9999999ff..fff
......ffffffff......
....................
....................
`, SpriteKind.FISH_BIG)
fish_big.setPosition(randint(20, 100), randint(20, 100))
if (Math.percentChance(50)) {
fish_big.setVelocity(20, randint(-20, 20))
} else {
fish_big.setVelocity(-20, randint(-20, 20))
}
fish_big.setFlag(SpriteFlag.BounceOnWall, true)
fish_big_num += 1
}
}
sprites.onOverlap(SpriteKind.Player, SpriteKind.FISH_BIG, function (sprite, otherSprite) {
if (controller.A.isPressed()) {
otherSprite.destroy(effects.fire, 100)
info.changeScoreBy(1)
fish_big_num += -1
}
})
function 生小魚 (x: number, y: number) {
fish_small = sprites.create(img`
. . . . . f f f f f f f . . . .
. . . . f f 8 8 8 8 8 f f . . f
. f f f f 8 8 8 8 8 8 8 f f . f
. f 1 1 8 8 8 1 8 8 8 8 8 f f 1
. f 1 f f 1 1 1 1 1 1 8 8 8 1 1
f f 1 f f 1 1 1 1 1 1 1 1 8 1 1
. f 1 1 1 9 9 9 1 1 1 1 1 f 1 1
. . f f f f 9 9 9 9 9 9 f f f 1
. . . . . . f f f f f f f . f 1
. . . . . . . . . . . . . . . f
`, SpriteKind.FISH_SMALL)
fish_small.setPosition(x, y)
if (Math.percentChance(50)) {
fish_small.setVelocity(15, randint(-20, 20))
} else {
fish_small.setVelocity(-15, randint(-20, 20))
}
fish_small.setFlag(SpriteFlag.BounceOnWall, true)
fish_small_num += 1
}
function eatFish () {
for (let value of sprites.allOfKind(SpriteKind.FISH_BIG)) {
if (value.x - mySprite.x < shark_dir * 8) {
if (Math.abs(value.y - mySprite.y) < 10) {
value.destroy(effects.fire, 100)
music.baDing.play()
info.changeScoreBy(1)
fish_big_num += -1
}
}
}
for (let value of sprites.allOfKind(SpriteKind.FISH_SMALL)) {
if (value.x - mySprite.x < shark_dir * 8) {
if (Math.abs(value.y - mySprite.y) < 10) {
value.destroy(effects.fire, 100)
music.baDing.play()
info.changeScoreBy(1)
fish_small_num += -1
}
}
}
}
sprites.onOverlap(SpriteKind.Player, SpriteKind.FISH_SMALL, function (sprite, otherSprite) {
if (controller.A.isPressed()) {
otherSprite.destroy(effects.fire, 100)
info.changeScoreBy(1)
fish_small_num += -1
}
})
let fish_num_total = 0
let fish_small_num = 0
let fish_small: Sprite = null
let fish_big_num = 0
let fish_big: Sprite = null
let shark_dir = 0
let mySprite: Sprite = null
tiles.setTilemap(tilemap`層級1`)
info.setScore(0)
生大魚(5)
mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
mySprite.setFlag(SpriteFlag.StayInScreen, true)
scene.cameraFollowSprite(mySprite)
animation.runImageAnimation(
mySprite,
[img`
.............ccfff..............
...........ccddbcf..............
..........ccddbbf...............
..........fccbbcf...............
.....fffffccccccff.........ccc..
...ffbbbbbbbcbbbbcfff....ccbbc..
..fbbbbbbbbcbcbbbbcccff.cdbbc...
ffbbbbbbffbbcbcbbbcccccfcdbbf...
fbcbbb11ff1bcbbbbbcccccffbbf....
fbbb11111111bbbbbcccccccbbcf....
.fb11133cc11bbbbcccccccccccf....
..fccc31c111bbbcccccbdbffbbcf...
...fc13c111cbbbfcddddcc..fbbf...
....fccc111fbdbbccdcc.....fbbf..
........ccccfcdbbcc........fff..
.............fffff..............
`,img`
.............ccfff..............
............cddbbf..............
...........cddbbf...............
..........fccbbcf............ccc
....ffffffccccccff.........ccbbc
..ffbbbbbbbbbbbbbcfff.....cdbbc.
ffbbbbbbbbbcbcbbbbcccff..cddbbf.
fbcbbbbbffbbcbcbbbcccccfffdbbf..
fbbb1111ff1bcbcbbbcccccccbbbcf..
.fb11111111bbbbbbcccccccccbccf..
..fccc33cc11bbbbccccccccfffbbcf.
...fc131c111bbbcccccbdbc...fbbf.
....f33c111cbbbfdddddcc.....fbbf
.....ff1111fbdbbfddcc........fff
.......cccccfbdbbfc.............
.............fffff..............
`,img`
..............cfff..............
............ccddbf..............
...........cbddbff.........ccc..
..........fccbbcf.........cbbc..
...fffffffccccccff.......cdbc...
.ffcbbbbbbbbbbbbbcfff....cdbf...
fcbbbbbbbbbcbbbbbbcccff.cdbf....
fbcbbbbffbbbcbcbbbcccccffdcf....
fbb1111ffbbbcbcbbbccccccbbcf....
.fb11111111bbcbbbccccccccbbcf...
..fccc33cb11bbbbcccccccfffbbf...
...fc131c111bbbcccccbdbc..fbbf..
....f33c111cbbccdddddbc....fff..
.....ff1111fdbbccddbcc..........
.......cccccfdbbbfcc............
.............fffff..............
`,img`
.............ccfff..............
............cddbbf..............
...........cddbbf...............
..........fccbbcf............ccc
....ffffffccccccff.........ccbbc
..ffbbbbbbbbbbbbbcfff.....cdbbc.
ffbbbbbbbbbcbcbbbbcccff..cddbbf.
fbcbbbbbffbbcbcbbbcccccfffdbbf..
fbbb1111ff1bcbcbbbcccccccbbbcf..
.fb11111111bbbbbbcccccccccbccf..
..fccc33cc11bbbbccccccccfffbbcf.
...fc131c111bbbcccccbdbc...fbbf.
....f33c111cbbbfdddddcc.....fbbf
.....ff1111fbdbbfddcc........fff
.......cccccfbdbbfc.............
.............fffff..............
`],
200,
true
)
info.startCountdown(60)
game.onUpdate(function () {
console.log("" + fish_big_num + "," + fish_small_num)
fish_num_total = fish_big_num + fish_small_num
info.player2.setScore(fish_num_total)
moveShark()
for (let value of sprites.allOfKind(SpriteKind.FISH_BIG)) {
if (value.vx > 0) {
value.setImage(img`
....................
....................
....................
........fffffff.....
ff.....ff88888ff....
8f....ff8888888fff..
8ff..ff8888818888f..
f1fff8888111111f1ff.
ff1888811111111ff1ff
.f11111111111111111f
ff119111111111111fff
11ffff911111999fff..
fff..ff9999999ff....
......ffffffff......
....................
....................
`)
} else {
value.setImage(img`
....................
....................
....................
.....fffffff........
....ff88888ff.....ff
..fff8888888ff....f8
..f8888188888ff..ff8
.ff1f1111118888fff1f
ff1ff1111111188881ff
f11111111111111111f.
fff111111111111911ff
..fff999111119ffff11
....ff9999999ff..fff
......ffffffff......
....................
....................
`)
}
}
for (let value2 of sprites.allOfKind(SpriteKind.FISH_SMALL)) {
if (value2.vx > 0) {
value2.setImage(img`
. . . . f f f f f f f . . . . .
f . . f f 9 9 9 9 9 f f . . . .
f . f f 9 9 9 9 9 9 9 f f f f .
1 f f 9 9 9 9 9 9 9 9 9 1 1 f .
1 1 9 9 9 9 1 1 1 1 1 f f 1 f .
1 1 9 9 1 1 1 1 1 1 1 f f 1 f f
1 1 f 1 1 1 1 1 9 9 9 1 1 1 f .
1 f f f 9 9 9 9 9 9 f f f f . .
1 f . f f f f f f f . . . . . .
f . . . . . . . . . . . . . . .
`)
} else {
value2.setImage(img`
. . . . . f f f f f f f . . . .
. . . . f f 9 9 9 9 9 f f . . f
. f f f f 9 9 9 9 9 9 9 f f . f
. f 1 1 9 9 9 1 9 9 9 9 9 f f 1
. f 1 f f 1 1 1 1 1 9 9 9 9 1 1
f f 1 f f 1 1 1 1 1 1 1 9 9 1 1
. f 1 1 1 9 9 9 1 1 1 1 1 f 1 1
. . f f f f 9 9 9 9 9 9 f f f 1
. . . . . . f f f f f f f . f 1
. . . . . . . . . . . . . . . f
`)
}
}
if (fish_num_total >= 20) {
game.over(false)
}
if (fish_num_total == 0) {
game.over(false)
}
})
// Bigl fish DIE
game.onUpdateInterval(2000, function () {
for (let value3 of sprites.allOfKind(SpriteKind.FISH_BIG)) {
if (Math.percentChance(30)) {
value3.destroy(effects.fire, 100)
fish_big_num += -1
}
}
})
// small fish Growh
game.onUpdateInterval(2000, function () {
for (let value4 of sprites.allOfKind(SpriteKind.FISH_SMALL)) {
if (Math.percentChance(50)) {
value4.setKind(SpriteKind.FISH_BIG)
value4.setImage(img`
....................
....................
....................
........fffffff.....
ff.....ff88888ff....
8f....ff8888888fff..
8ff..ff8888818888f..
f1fff8888111111f1ff.
ff1888811111111ff1ff
.f11111111111111111f
ff119111111111111fff
11ffff911111999fff..
fff..ff9999999ff....
......ffffffff......
....................
....................
`)
fish_small_num += -1
fish_big_num += 1
}
}
})
// small fish BIRTH
game.onUpdateInterval(1500, function () {
for (let value5 of sprites.allOfKind(SpriteKind.FISH_BIG)) {
if (Math.percentChance(40)) {
生小魚(value5.x, value5.y)
}
}
})