0 080q>S}Wm8m%q]$(H;]<}D<}Vm,8e 2TvͫgE#2Tv2Tvkffffffffwwwwwwww2TvͫgE# ܈݈݈݈(8Hem~^v}gﻻϩϙϜwwwwWuwwgugwgffvffVeeffUeefVUUeUw{wWwVUwwfUufeVUVUfVkuVeww[Vw{kv{UU{VVffeUgfVVvffewfffkggv{vv{VVgfeUgfVVgffegffVwfffwgfw{wwKRkkw[{gkww  Ꞟ舚舙;3#;#++ݻݻ̻ͼݼݻ޻ݘ ݍ ݍЍݍݍݍ Ѝ ݽ޻ތ޸  ݍݍ @ 232  ""232  " 232  " 232  ""232  " B#2# 00C4B#2# 0CC2#2# ffffVUUeVVeeVVeeVVeeVUUeVUUeffffDD@DD@O@N@N@DDDDDD@DD@O@N@N@DDDD Ȍ Ȍ <  <  ϩϙϜ", """,","""" P`lf0@0@0tF0sG03D0@0@0tF0tG03Dgwvg v p ` pfvg p pfw11ҠҠڠڠڠҠ1걲ڠҠ1⠠⠠٠Ҡ٠Ҡ٠⠠Ҡ1건ڠ⠠1⠠頠頠⠠1거ذذڠ1Ҡڠڠڠ1Ҡ1⠠ҠҠڠװװڠҠҠĠ1⠠ꢢڠҠ⠠ĠԠڠ簶ޠ⠠б⠠Ҡ1Ҡ거ڠҠ⠠٠٠ذ౰ڠڠ٠⠠1⠠űڠҠ⠠頠ڠ頠ڠ頠ڠ⠠㠠ڠڠڕڠڠ거װװڠڠڠڠԕڠб거簰簰ڠڠڠذ٠ڠıڠװָڠڠ頠ڠڠб簰бڠڠְְڠڠбװְڠӓ౰젠젠젠౰ޠޠб氰ޠб앒애Ԕ䰰氰00000ذ౰ذذ౰000000000000000000000000000000000000000000000ꠠ !@PP @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@000000000000000000000000000000@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ PPPPPPPPPPPPPPPPPPPPPPPPPPPPPP`````````````````````````````````9`ko|`````````````````````````p`P$3BQq p?ڏʏP00?00&080\00000000000000000000000`7Ypp`p#%Y} pPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP}eee]be `eee]be `eee e e ee e e eUbeeeeeeE E E E EEeD D D D D DDDbe` e eDbe` e eLbE` Dbe` eee eeeeee eee EEE EEEEeee eeeeee eee EEE EEEE e eee e e eee ee EEeE E E e eee e e eee ee EEeE E E4qq qqq qqq qqqq qqq qqq qqMbRrr`rrMbR R `R Rrrrr R R RTR R   H 6""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""",,"""",,",,""","",,"""","""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""",",",""",""""",",""""""","",",""",""","","""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""",","",""""",",,"""""",","",""""""","""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""",",""""""""",,,,","""""",,"""",""","","""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""",",",""",,",",,,""""",",","""",""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""">.232.."Ȍ>((".".>"2."#.22"333343C3U5C4SQ33U^UUUUU> "   "  ",0 0@$>S}Wmu488m%q]$(H;]<}D<}Vm,8e"DD@DD@O@N@N@DDDDDD@DD@O@N@N@DDDD0@0@0tF0tG03D0@0@0tF0sG03DDDD@DD@DD@L@O@HDDDDDDDLOH@H@H@4C@DD@DDDDDHH4CDDDDDDD 232  ""232  "0@0@0t0F 0 " 2   ""2#2 0 " 2 " ""2#2" " 2 "22"3333CU5CQ3PUU3434S3UUUU"3333CU5CQ3PUU3434S3UUUU"3333DU5CQ3PUU3434S3UUUU <  <  6-- title: Child of the Moon -- author: Percecal -- desc: -- -- site: -- -- license: MIT License (change this to your license of choice) -- version: 1.0 -- script: lua -----Main----- Character = { x = 80, y = 112, vx = 0, vy = 0, live = true, death = 0 } Fireball = { x = 0, y = 0, Created = false, vx = 0, v = 0, sprite =1 } Ghost = { sprite = 336, vx = 4 } Ghost_location = { } Coin = { sprite = 320, score = 0 } Coins = { } Trap = { } JumpPad = { } Passage = { } Passage2 = { } Map = { ux = 0, uy = 0, dx = 30, dy = 17, level = 0, level_change = false, difference_x = 0, difference_y = 0, } Time_Check = { last = 0, flag = false } Start = { character_sprite = 368, } time_flag = false move_speed = 1 gravity = 0.2 direction = 1 animation_frame = 1 sprite = 1 Music = false vector = 1 pass_trigger = false menu_time = 0 Crown_sprite = 370 function TIC() poke(0x3FFB, 0) Menu() Time_flag() sync(2, 0) sync(32, 0) print('v1.0') if Map.level > 0 and Map.level < 99 then cls() animation_frame = time()//250 ChangeLevels() map(Map.ux, Map.uy, Map.dx, Map.dy) HUD() MoveCharacter() CheckLimits() Fire_flag() UpdateMobs() FireballThrow() CoinMechanics() GhostMechanics() TrapMechanics() JumpPad_Mechanics() Passage_Mechanics() Passage_Mechanics_2() Crown() Death() ------Character----- --animation-- if animation_frame % 2 == 0 then sprite = 256 Fireball.sprite = 289 Coin.sprite = 320 Ghost.sprite = 336 Crown_sprite = 369 if Character.vy > 0 then sprite = 264 elseif btn(3) or btn (2)then sprite = 260 end else sprite = 258 Fireball.sprite = 290 Coin.sprite = 321 Ghost.sprite = 337 Crown_sprite = 370 if Character.vy > 0 then sprite = 264 elseif btn(3) or btn (2) then sprite = 262 end end spr(sprite , Character.x , Character.y, 0, 1, 0, 0 , 2, 2) end end -----Move----- function MoveCharacter() if Map.level > 0 then --move right-- if btn(3) then if Music == false then music(0) Music = true end Character.vx = move_speed direction = 1 --move left-- elseif btn(2) then if Music == false then music(0) Music = true end Character.vx = -1 * move_speed direction = -1 --stop-- else Character.vx = 0 end --jump-- if Character.vy == 0 and btnp(4) then Character.vy = -6 sfx(2,'D-4', 10, 2, 5, 3) elseif Character.y > 112 then Character.vy = 0 else Character.vy = Character.vy + gravity end end --check collisions-- u = Character.y + Character.vy d = Character.y + Character.vy + 14-- - wight sprite l = Character.x + Character.vx r = Character.x + Character.vx + 14 if Character.vx < 0 and (Tile(l,u)) == true or (Tile(l,d)) == true then Character.vx = 0 end if Character.vx > 0 and (Tile(r,u)) == true or (Tile(r,d)) == true then Character.vx = 0 end u = Character.y + Character.vy d = Character.y + Character.vy + 14-- - wight sprite l = Character.x + Character.vx r = Character.x + Character.vx + 14 --check for bottom collisions-- if Tile(l,d+1) == true or Tile(r,d+1) == true then Character.vy = 0 else Character.vy = Character.vy + gravity end --check for top collisons-- if Character.vy < 0 and (Tile(l, u) or Tile(r, u)) then Character.vy =0 end --update position-- Character.x = Character.x + Character.vx --Y Axis-- Character.y = Character.y + Character.vy end -----Limits----- function CheckLimits() if Character.y < 1 then Character.y = 1 end if Character.y > 128 then Character.y = 128 end if Character.x < 1 then Character.x = 1 end if Character.x > 231 then Character.x = 231 end --Sprite height = 8px --Window height = 136px --136 - 8 = 128 --(Wight = 240, likewise) end function FireballThrow() --fireball mechanics-- if Fireball.Created == true then Fireball.x = Fireball.x + Fireball.vx if Fireball.x < 0 or Fireball.x >232 then Fireball.Created = false else spr(Fireball.sprite, Fireball.x, Fireball.y, 0) if (time()/ 600) - Time_Check.last > 0.4 then Fireball.Created = false Fireball.x = 0 Fireball.y = 0 sfx(10, 'A-4', 15, 2, 2, 3) end end elseif btnp(6) and pass_trigger == false then Fireball.Created = true Time_Check.flag = true sfx(8,'C-4', 15, 2, 5, 3) if direction == 1 then Fireball.x = Character.x +8 Fireball.v = 1 else Fireball.x = Character.x -8 Fireball.v = -1 end Fireball.y = Character.y + 4 end Fireball.vx = Fireball.v * 4 end -----Checking the tile for passability----- function Tile(x, y) if Map.level ==1 then return mget(x // 8, y // 8) < 64 elseif Map.level > 1 then return mget((x + Map.difference_x) // 8, (y + Map.difference_y) // 8) < 64 end end -----Coin----- function CoinMechanics() for i, coin in ipairs(Coins) do spr(Coin.sprite, coin.x, coin.y, 0) if (Character.x + 4 - coin.x > -14 and Character.x + 4 - coin.x < 14) and (Character.y + 4 - coin.y > -14 and Character.y + 4 - coin.y < 14)then table.remove(Coins, i) Coin.score = Coin.score + 1 sfx(0,'D-4', 10, 2) end end end -----Ghost----- function GhostMechanics() for i, ghost in ipairs(Ghost_location) do ghost.x = ghost.x + ghost.vector if ghost.x - ghost.st_x == 30 and ghost.x - ghost.st_x > 0 or ghost.x - ghost.st_x == -30 then ghost.vector = ghost.vector *-1 end spr(Ghost.sprite, ghost.x, ghost.y, 0) if (Character.x + 4 - ghost.x > -14 and Character.x + 4 - ghost.x < 14) and (Character.y + 4 - ghost.y > -14 and Character.y + 4 - ghost.y < 14) then Character.lives = false sfx(11,'D-4',15, 2) end if (Fireball.x + 4 - ghost.x > - 14 and Fireball.x + 5 - ghost.x < 14) and (Fireball.y + 4 - ghost.y > -14 and Fireball.y + 4 - ghost.y < 14) then table.remove(Ghost_location, i) sfx(9,'A-4', 10, 2) end end end -----Trap----- function TrapMechanics() for i, trap in ipairs(Trap) do spr(352, trap.x, trap.y, 0) if (Character.x + 4 - trap.x > -5 and Character.x + 4 - trap.x < 5) and (Character.y + 4 - trap.y > -11 and Character.y + 4 - trap.y < 11)then Character.lives = false sfx(13,'D-2', 10, 0) end end end -----JumpPad----- function JumpPad_Mechanics() for i, pad in ipairs(JumpPad) do spr(368, pad.x, pad.y, 0) if (Character.x + 4 - pad.x > -14 and Character.x + 4 - pad.x < 14) and (Character.y + 4 - pad.y > -14 and Character.y + 4 - pad.y < 14)then if btnp(4) then Character.vy = -8 sfx(14,'D-4', 10, 2) end end end end -----Passage----- function Passage_Mechanics() for i, pass in ipairs(Passage) do spr(384, pass.x, pass.y, 0, 1, 0, 0 , 2, 20) if (Character.x + 4 - pass.x > -14 and Character.x + 4 - pass.x < 14) and (Character.y + 4 - pass.y > -14 and Character.y + 4 - pass.y < 14)then pass_trigger = true sfx(15,'D-2', 10, 2, 5) end end end -----Passage----- function Passage_Mechanics_2() for i, pass2 in ipairs(Passage2) do spr(384, pass2.x, pass2.y, 0, 1, 0, 0 , 2, 20) if (Character.x + 4 - pass2.x > -14 and Character.x + 4 - pass2.x < 14) and (Character.y + 4 - pass2.y > -14 and Character.y + 4 - pass2.y < 14)then pass_trigger = false sfx(12,'D-2', 10, 2, 5) end end end function Crown() if Map.level == 8 then spr(Crown_sprite, 120, 32, 0) if(Character.x + 4 - 120 > -14 and Character.x + 4 - 120 < 14) and (Character.y + 4 - 32 > -14 and Character.y + 4 - 32 < 14)then Map.level = 99 sfx(0,'D-4', 10, 2) menu_time = time() // 1000 end end end -----HUD----- function HUD() rect(0, 0, 240, 16, 15) rect(0, 0, 240, 14, 8) rect(40, 2, 12, 11, 8) print("score: " ..Coin.score, 5, 5, 13, 0, 1, 1) spr(320, 42, 4, 0) print("death: " ..Character.death, 200, 5, 13, 0, 1, 1) spr(323, 190, 4, 0) print('Child of the Moon',65, 5, 12, 0) end function ChangeLevels() if Character.x == 225 then Map.level_change = true Character.x = 10 if Map.level % 8 == 0 then Map.difference_x = 0 Map.difference_y = Map.difference_y + 136 Map.ux = 0 Map.uy = Map.uy + 17 Map.dx = 30 Map.dy = Map.dy + 17 else Map.difference_x = Map.difference_x + 240 Map.dx = Map.dx + 60 Map.ux = Map.ux + 30 end Map.level = Map.level + 1 Map.restart = false end end function UpdateMobs() if Map.level_change == true then Character.y = 112 Coins ={} Ghost_location= {} Trap= {} JumpPad = {} Passage = {} Passage2 = {} time_flag = false if Map.level == 1 then table.insert(JumpPad, {x = 16, y = 120}) table.insert(Coins, {x = 4, y = 34}) table.insert(Coins, {x = 120, y = 100}) table.insert(Ghost_location, {x = 180, y =115, st_x = 180, vector = 1}) table.insert(Trap, {x = 200, y = 128}) table.insert(Trap, {x = 192, y = 128}) elseif Map.level == 2 then table.insert(Coins, {x = 150, y = 60}) table.insert(Coins, {x = 160, y = 118}) table.insert(Ghost_location, {x = 175, y =60, st_x = 175, vector = 1}) table.insert(Ghost_location, {x = 160, y =92, st_x = 160, vector = 1}) table.insert(Trap, {x = 200, y = 128}) table.insert(Trap, {x = 208, y = 129}) elseif Map.level == 3 then table.insert(JumpPad, {x = 72, y = 96}) table.insert(Coins, {x = 48, y = 56}) table.insert(Coins, {x = 36, y = 24}) table.insert(Ghost_location, {x = 58, y = 88, st_x = 58, vector = 1}) elseif Map.level == 4 then table.insert(Trap, {x = 120, y = 120}) table.insert(Trap, {x = 128, y = 120}) table.insert(Trap, {x = 144, y = 120}) table.insert(Trap, {x = 152, y = 120}) table.insert(Trap, {x = 168, y = 120}) table.insert(Trap, {x = 176, y = 120}) table.insert(Coins, {x = 16, y = 64}) table.insert(Ghost_location, {x = 190, y = 108, st_x = 190, vector = 1}) elseif Map.level == 5 then table.insert(JumpPad, {x = 42, y = 120}) table.insert(Trap, {x = 48, y = 128}) table.insert(Trap, {x = 56, y = 128}) table.insert(Coins, {x = 136, y = 38}) table.insert(Coins, {x = 80, y = 118}) table.insert(Ghost_location, {x = 190, y = 114, st_x = 190, vector = 1}) elseif Map.level == 6 then table.insert(JumpPad, {x = 64, y = 120}) table.insert(Trap, {x = 72, y = 128}) table.insert(Trap, {x = 80, y = 128}) table.insert(Coins, {x = 64, y = 24}) table.insert(Coins, {x = 126, y = 112}) table.insert(Ghost_location, {x = 72, y = 30, st_x = 64, vector = 1}) table.insert(Ghost_location, {x = 136, y = 115, st_x = 136, vector = 1}) table.insert(Passage, {x = 28, y = 112}) table.insert(Passage2, {x = 180, y = 112}) elseif Map.level == 7 then table.insert(Coins, {x = 72, y = 16}) table.insert(Coins, {x = 200, y = 42}) table.insert(Ghost_location, {x = 38, y = 22, st_x = 38, vector = 1}) table.insert(Ghost_location, {x = 118, y = 46, st_x = 118, vector = 1}) table.insert(Ghost_location, {x = 85, y = 114, st_x = 85, vector = 1}) table.insert(Passage, {x = 52, y = 112}) table.insert(Passage2, {x = 228, y = 112}) elseif Map.level == 8 then table.insert(Ghost_location, {x = 80, y = 75, st_x = 80, vector = 1}) table.insert(Ghost_location, {x = 168, y = 75, st_x = 168, vector = 1}) table.insert(Trap, {x = 42, y = 128}) table.insert(Trap, {x = 50, y = 128}) table.insert(Trap, {x = 184, y = 128}) table.insert(Trap, {x = 192, y = 128}) table.insert(Coins, {x = 8, y = 40}) table.insert(Coins, {x = 224, y = 40}) table.insert(JumpPad, {x = 26, y = 120}) table.insert(JumpPad, {x = 204, y = 120}) end Map.level_change = false end end function Time_flag() flag = time() // 600 if flag % 4 == 0 then time_flag = false elseif flag % 2 == 0 then time_flag = true end end function Fire_flag() if Time_Check.flag == true then Time_Check.last = time()/ 600 Time_Check.flag = false end end function Death() if Character.lives == false then Character.x = 30 Character.y = 110 Character.lives = true Character.death = Character.death + 1 end end function Menu() if Map.level == 0 then rect(0, 0, 240, 136, 0) sync(2, 1) sync(32, 1) if (time() // 600) % 2 == 0 then Start.character_sprite = 370 Start.fire_sprite = 400 Start.ghost = 432 else Start.character_sprite = 368 Start.fire_sprite = 402 Start.ghost = 433 end spr(448, 100,50, 8, 5) spr(Start.character_sprite, 112 ,55, 0, 1, 0, 0 , 2, 2) spr(Start.fire_sprite, 112 ,65, 0, 1, 0, 0 , 2, 2) spr(Start.ghost, 135, 40, 0, 1, 0, 0) spr(Start.ghost, 85, 60, 0, 1, 0, 0) spr(Start.ghost, 135, 90, 0, 1, 0, 0) print('press', 102, 110, 14) spr(464, 133, 108, 0, 1, 0, 0) print('B', 135, 110, 2, false, 1) print('Child of the Moon', 30, 10, 12, false, 2) if Music == false then music(3) Music = true end if btnp(5) then Map.level = 1 Map.level_change = true sfx(16,'A-5', 12, 0, 15) music() Music = false end end ---end--- if Map.level == 99 then rect(0, 0, 240, 136, 0) sync(2, 1) sync(32, 1) if (time() // 600) % 2 == 0 then Start.coin = 288 Start.crown = 304 Start.ghost = 433 else Start.coin = 289 Start.crown = 305 Start.ghost = 432 end print('score '..Coin.score, 105, 50, 12, true) print('time '..menu_time, 105, 60, 12, true) print('death '..Character.death, 105, 70, 12, true) print('press', 102, 110, 14) print('to restart', 92, 120, 14) spr(Start.coin, 93, 48, 0, 1, 0, 0) spr(Start.crown, 93, 56, 0, 1, 0, 0) spr(Start.ghost, 93, 68, 0, 1, 0, 0) print('B', 135, 110, 2, false, 1) print('Child of the Moon', 30, 10, 12, false, 2) if Music == false then music(3) Music = true end if btnp(5) then reset() end end end