diff --git a/graphics/chest opening.png b/graphics/chest opening.png new file mode 100644 index 0000000..68c3baf Binary files /dev/null and b/graphics/chest opening.png differ diff --git a/graphics/closed chest.png b/graphics/closed chest.png new file mode 100644 index 0000000..e7c0025 Binary files /dev/null and b/graphics/closed chest.png differ diff --git a/graphics/cloud.png b/graphics/cloud.png new file mode 100644 index 0000000..4023d4b Binary files /dev/null and b/graphics/cloud.png differ diff --git a/graphics/key.png b/graphics/key.png new file mode 100644 index 0000000..068249b Binary files /dev/null and b/graphics/key.png differ diff --git a/graphics/mummywalking.png b/graphics/mummywalking.png new file mode 100644 index 0000000..5e16f71 Binary files /dev/null and b/graphics/mummywalking.png differ diff --git a/graphics/mummywalking1.png b/graphics/mummywalking1.png new file mode 100644 index 0000000..e5e0f73 Binary files /dev/null and b/graphics/mummywalking1.png differ diff --git a/graphics/mummywalking2.png b/graphics/mummywalking2.png new file mode 100644 index 0000000..d8b658c Binary files /dev/null and b/graphics/mummywalking2.png differ diff --git a/graphics/mummywalking3.png b/graphics/mummywalking3.png new file mode 100644 index 0000000..5f65d78 Binary files /dev/null and b/graphics/mummywalking3.png differ diff --git a/graphics/pixel chest.png b/graphics/pixel chest.png new file mode 100644 index 0000000..797d7cc Binary files /dev/null and b/graphics/pixel chest.png differ diff --git a/graphics/you've won.png b/graphics/you've won.png new file mode 100644 index 0000000..55ac554 Binary files /dev/null and b/graphics/you've won.png differ diff --git a/main/graphics.atlas b/main/graphics.atlas index b0ce16c..5e4bf56 100644 --- a/main/graphics.atlas +++ b/main/graphics.atlas @@ -112,6 +112,21 @@ images { images { image: "/graphics/level3.png" } +images { + image: "/graphics/pixel chest.png" +} +images { + image: "/graphics/closed chest.png" +} +images { + image: "/graphics/key.png" +} +images { + image: "/graphics/you\'ve won.png" +} +images { + image: "/graphics/cloud.png" +} animations { id: "run_left" images { @@ -235,4 +250,21 @@ animations { } playback: PLAYBACK_LOOP_FORWARD } +animations { + id: "walking_mummy" + images { + image: "/graphics/mummywalking.png" + } + images { + image: "/graphics/mummywalking1.png" + } + images { + image: "/graphics/mummywalking2.png" + } + images { + image: "/graphics/mummywalking3.png" + } + playback: PLAYBACK_LOOP_FORWARD + fps: 10 +} extrude_borders: 2 diff --git a/main/level1.collection b/main/level1.collection index c87f68a..9127279 100644 --- a/main/level1.collection +++ b/main/level1.collection @@ -604,6 +604,9 @@ embedded_instances { " texture: \\\"/main/graphics.atlas\\\"\\n" "}\\n" "\"\n" + " position {\n" + " z: 0.1\n" + " }\n" " scale {\n" " x: -0.4\n" " y: 0.4\n" @@ -751,7 +754,7 @@ embedded_instances { " position {\n" " x: 527.5\n" " y: 344.0\n" - " z: 0.4\n" + " z: 0.5\n" " }\n" " scale {\n" " x: 1.3\n" diff --git a/main/level1.script b/main/level1.script index e74495c..f649395 100644 --- a/main/level1.script +++ b/main/level1.script @@ -17,6 +17,7 @@ function init(self) msg.post("level1:/pause#sprite", "disable") msg.post("/player#player", "level1") msg.post("main:/controller#main", "play background music") + msg.post("/mummy#mummy", "creator", { creator = msg.url() }) print("level1") end @@ -122,6 +123,18 @@ function on_message(self, message_id, message, sender) end --print ("Amulet removed, we now have " .. self.amulet_count .. " amulets left") end + if message_id == hash("manual_pause") then + if not self.paused then + self.paused = true + -- msg.post("/pause#sprite", "enable") + -- msg.post("/player#player", "pause") + for i, id in ipairs(self.curses) do + local id_url = msg.url(id) + msg.post(id_url, "pause") + end + self.won = true + end + end end function on_input(self, action_id, action) diff --git a/main/level2.collection b/main/level2.collection index 20f6936..6bec9b5 100644 --- a/main/level2.collection +++ b/main/level2.collection @@ -264,8 +264,8 @@ embedded_instances { " shapes {\\n" " shape_type: TYPE_BOX\\n" " position {\\n" - " x: 855.0\\n" - " y: 532.0\\n" + " x: 867.0\\n" + " y: 533.0\\n" " }\\n" " rotation {\\n" " z: 0.013529582\\n" @@ -287,7 +287,7 @@ embedded_instances { " index: 3\\n" " count: 3\\n" " }\\n" - " data: 201.29485\\n" + " data: 215.48624\\n" " data: 10.0\\n" " data: 10.0\\n" " data: 131.92336\\n" diff --git a/main/level2.script b/main/level2.script index ad52af5..39c53e9 100644 --- a/main/level2.script +++ b/main/level2.script @@ -17,6 +17,7 @@ function init(self) msg.post("level2:/pause#sprite", "disable") msg.post("/player#player", "level2") msg.post("main:/controller#main", "play background music") + msg.post("/mummy#mummy", "creator", { creator = msg.url() }) print("level2") end @@ -122,6 +123,18 @@ function on_message(self, message_id, message, sender) end --print ("Amulet removed, we now have " .. self.amulet_count .. " amulets left") end + if message_id == hash("manual_pause") then + if not self.paused then + self.paused = true + -- msg.post("/pause#sprite", "enable") + -- msg.post("/player#player", "pause") + for i, id in ipairs(self.curses) do + local id_url = msg.url(id) + msg.post(id_url, "pause") + end + self.won = true + end + end end function on_input(self, action_id, action) diff --git a/main/level3.collection b/main/level3.collection index cd14556..274ff14 100644 --- a/main/level3.collection +++ b/main/level3.collection @@ -981,6 +981,8 @@ embedded_instances { "mask: \\\"curse\\\"\\n" "mask: \\\"amulet\\\"\\n" "mask: \\\"mummy\\\"\\n" + "mask: \\\"key\\\"\\n" + "mask: \\\"chest\\\"\\n" "embedded_collision_shape {\\n" " shapes {\\n" " shape_type: TYPE_BOX\\n" @@ -1661,3 +1663,290 @@ embedded_instances { "}\n" "" } +embedded_instances { + id: "chest" + data: "embedded_components {\n" + " id: \"sprite\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"closed chest\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 1021.0\n" + " y: 566.0\n" + " z: 0.1\n" + " }\n" + " scale {\n" + " x: 0.08\n" + " y: 0.08\n" + " }\n" + "}\n" + "embedded_components {\n" + " id: \"sprite1\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"pixel chest\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 1020.0\n" + " y: 573.0\n" + " z: 0.2\n" + " }\n" + " scale {\n" + " x: 0.09\n" + " y: 0.09\n" + " }\n" + "}\n" + "embedded_components {\n" + " id: \"collisionobject\"\n" + " type: \"collisionobject\"\n" + " data: \"type: COLLISION_OBJECT_TYPE_KINEMATIC\\n" + "mass: 0.0\\n" + "friction: 0.1\\n" + "restitution: 0.5\\n" + "group: \\\"chest\\\"\\n" + "mask: \\\"player\\\"\\n" + "embedded_collision_shape {\\n" + " shapes {\\n" + " shape_type: TYPE_BOX\\n" + " position {\\n" + " x: 1019.0\\n" + " y: 572.0\\n" + " }\\n" + " rotation {\\n" + " }\\n" + " index: 0\\n" + " count: 3\\n" + " }\\n" + " data: 29.086132\\n" + " data: 30.405022\\n" + " data: 10.0\\n" + "}\\n" + "\"\n" + "}\n" + "" +} +embedded_instances { + id: "key" + data: "embedded_components {\n" + " id: \"sprite\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"key\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 971.0\n" + " y: 196.0\n" + " z: 0.1\n" + " }\n" + " scale {\n" + " x: 0.05\n" + " y: 0.05\n" + " }\n" + "}\n" + "embedded_components {\n" + " id: \"collisionobject\"\n" + " type: \"collisionobject\"\n" + " data: \"type: COLLISION_OBJECT_TYPE_KINEMATIC\\n" + "mass: 0.0\\n" + "friction: 0.1\\n" + "restitution: 0.5\\n" + "group: \\\"key\\\"\\n" + "mask: \\\"player\\\"\\n" + "embedded_collision_shape {\\n" + " shapes {\\n" + " shape_type: TYPE_BOX\\n" + " position {\\n" + " x: 971.0\\n" + " y: 196.0\\n" + " }\\n" + " rotation {\\n" + " }\\n" + " index: 0\\n" + " count: 3\\n" + " }\\n" + " data: 10.944113\\n" + " data: 21.498772\\n" + " data: 10.0\\n" + "}\\n" + "\"\n" + "}\n" + "" +} +embedded_instances { + id: "won" + data: "embedded_components {\n" + " id: \"sprite\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"you\\\\\\\'ve won\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 376.0\n" + " y: 334.0\n" + " z: 0.9\n" + " }\n" + "}\n" + "" +} +embedded_instances { + id: "key_symbol" + data: "embedded_components {\n" + " id: \"sprite\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"key\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 1012.0\n" + " y: 653.0\n" + " z: 0.2\n" + " }\n" + " scale {\n" + " x: 0.05\n" + " y: 0.05\n" + " z: 2.12\n" + " }\n" + "}\n" + "" +} +embedded_instances { + id: "mummy_explosion" + data: "embedded_components {\n" + " id: \"sprite\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"explosion\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 932.0\n" + " y: 603.0\n" + " z: 0.1\n" + " }\n" + " scale {\n" + " x: 0.3\n" + " y: 0.3\n" + " }\n" + "}\n" + "embedded_components {\n" + " id: \"sprite1\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"explosion\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "size {\\n" + " x: 202.0\\n" + " y: 202.0\\n" + "}\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 894.0\n" + " y: 638.0\n" + " z: 0.1\n" + " }\n" + " scale {\n" + " x: 0.3\n" + " y: 0.3\n" + " }\n" + "}\n" + "embedded_components {\n" + " id: \"sprite2\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"explosion\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "size {\\n" + " x: 202.0\\n" + " y: 202.0\\n" + "}\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 949.0\n" + " y: 651.0\n" + " z: 0.1\n" + " }\n" + " scale {\n" + " x: 0.3\n" + " y: 0.3\n" + " }\n" + "}\n" + "embedded_components {\n" + " id: \"sprite3\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"explosion\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "size {\\n" + " x: 202.0\\n" + " y: 202.0\\n" + "}\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 885.0\n" + " y: 565.0\n" + " z: 0.1\n" + " }\n" + " scale {\n" + " x: 0.3\n" + " y: 0.3\n" + " }\n" + "}\n" + "embedded_components {\n" + " id: \"sprite4\"\n" + " type: \"sprite\"\n" + " data: \"default_animation: \\\"explosion\\\"\\n" + "material: \\\"/builtins/materials/sprite.material\\\"\\n" + "size {\\n" + " x: 202.0\\n" + " y: 202.0\\n" + "}\\n" + "textures {\\n" + " sampler: \\\"texture_sampler\\\"\\n" + " texture: \\\"/main/graphics.atlas\\\"\\n" + "}\\n" + "\"\n" + " position {\n" + " x: 951.0\n" + " y: 569.0\n" + " z: 0.1\n" + " }\n" + " scale {\n" + " x: 0.3\n" + " y: 0.3\n" + " }\n" + "}\n" + "" +} diff --git a/main/level3.script b/main/level3.script index bb1659e..fa5a84d 100644 --- a/main/level3.script +++ b/main/level3.script @@ -13,11 +13,20 @@ function init(self) self.mummy_timer = 0 self.paused = false + self.won = false + self.won_sprite_timer = 2 + self.won_timer = 3 + createamulets(self) msg.post("level3:/pause#sprite", "disable") msg.post("/player#player", "level3") msg.post("main:/controller#main", "play background music") print("level3") + msg.post("chest#sprite1", "disable") + msg.post("won#sprite", "disable") + msg.post("key_symbol#sprite", "disable") + msg.post("mummy_explosion", "disable") + msg.post("/mummy#mummy", "creator", { creator = msg.url() }) end function createamulets(self) @@ -78,6 +87,17 @@ function update(self, dt) self.curse_count = self.curse_count + 1 end end + if self.won == true then + self.won_timer = self.won_timer - dt + if self.won_timer <= 0 then + msg.post("won#sprite", "enable") + msg.post("mummy_explosion", "disable") + self.won_sprite_timer = self.won_sprite_timer - dt + if self.won_sprite_timer <= 0 then + msg.post("main:/controller#main", "NoMoreLives") + end + end + end end function fixed_update(self, dt) @@ -122,6 +142,18 @@ function on_message(self, message_id, message, sender) end --print ("Amulet removed, we now have " .. self.amulet_count .. " amulets left") end + if message_id == hash("manual_pause") then + if not self.paused then + self.paused = true +-- msg.post("/pause#sprite", "enable") +-- msg.post("/player#player", "pause") + for i, id in ipairs(self.curses) do + local id_url = msg.url(id) + msg.post(id_url, "pause") + end + self.won = true + end + end end function on_input(self, action_id, action) diff --git a/main/main.script b/main/main.script index e71375e..511aa84 100644 --- a/main/main.script +++ b/main/main.script @@ -2,11 +2,9 @@ function init(self) msg.post(".", "acquire_input_focus") -- show the title screen when the game is loaded - -- msg.post("#startscreen_proxy", "load") - msg.post("#level3prescreen_proxy", "load") + msg.post("#startscreen_proxy", "load") self.collection_to_load = "" --- self.current_collection = "#startscreen_proxy" - self.current_collection = "#level3prescreen_proxy" + self.current_collection = "#startscreen_proxy" --msg.post("#level2_proxy", "load") @@ -125,6 +123,7 @@ function on_message(self, message_id, message, sender) elseif message_id == hash("escape") then msg.post(self.current_collection, "unload") self.collection_to_load = "#startscreen_proxy" + self.hide_banner = true elseif message_id == hash("show level1prescreen") then msg.post(self.current_collection, "unload") @@ -180,6 +179,12 @@ function on_message(self, message_id, message, sender) self.current_score = self.current_score + 100 --print(self.current_score) + elseif message_id == hash("add 500 points") then + self.current_score = self.current_score + 500 + + elseif message_id == hash("add 1000 points") then + self.current_score = self.current_score + 1000 + elseif message_id == hash("play amulet sound") then sound.play("sound#amulet_sound", {speed = 1, gain = (self.sounds_volume - 547)/(887 - 547)}) elseif message_id == hash("play dying sound") then diff --git a/main/mummy.script b/main/mummy.script index 58a86ae..50dc193 100644 --- a/main/mummy.script +++ b/main/mummy.script @@ -38,6 +38,9 @@ function update(self, dt) self.velocity.y = self.velocity.y + self.gravity * dt end go.set_position(pos) + if pos.x >= 1100 then + msg.post("main:/controller#main", "LevelCompleted") + end end function fixed_update(self, dt) @@ -51,9 +54,25 @@ end function on_message(self, message_id, message, sender) if message_id == hash("explode") then - sprite.play_flipbook("#still", hash("explosion")) + msg.post("level3:/controller#level3", "manual_pause") + go.delete("mummy") +-- sprite.play_flipbook("#still", hash("explosion")) +-- msg.post(self.creator, "mummy_deleted") --msg.post("mummy", "disable") end + if message_id == hash("play_anim") then + sprite.play_flipbook("/mummy#still", "walking_mummy") + local flip_y = vmath.quat_rotation_y(math.rad(180)) + go.set_rotation(flip_y) + go.set_scale(vmath.vector3(1.3, 1.3, 1)) + self.velocity.x = 250 + msg.post(self.creator, "manual_pause") + print("creator = " .. self.creator) + end + if message_id == hash("creator") then + self.creator = message.creator + print("creator set for mummy = " .. self.creator) + end end function on_input(self, action_id, action) diff --git a/main/player.script b/main/player.script index e792887..7c909f1 100644 --- a/main/player.script +++ b/main/player.script @@ -122,7 +122,12 @@ function init(self) self.current_movement = Movement.STILL_RIGHT self.current_level = "level1" - + + self.holding_key = false + self.scored = false + + self.mummy_walking = false + self.touching_mummy = false go.set_position(vmath.vector3(100,100,0.2)) end @@ -372,13 +377,45 @@ function on_message(self, message_id, message, sender) msg.post("main:/controller#main", "play amulet sound") end if message.group == hash("mummy") then - msg.post("main:/controller#main", "LevelCompleted") - msg.post("main:/controller#main", "play mummy sound") + -- sprite.play_flipbook("/mummy#still", "walking_mummy") + if self.touching_mummy == false then + self.mummy_walking = true + msg.post("mummy#mummy", "play_anim") + self.touching_mummy = true + end + if self.mummy_walking == false then + msg.post("main:/controller#main", "LevelCompleted") + msg.post("main:/controller#main", "play mummy sound") + end --print("collision with mummy") if self.current_level == "level3" then msg.post("/mummy#mummy", "explode") + msg.post("mummy_explosion", "enable") + msg.post("main:/controller#main", "add 500 points") + print("500") + if self.holding_key == true then + msg.post("chest#sprite1", "enable") + msg.post("chest#sprite", "disable") + if self.scored == false then + msg.post("main:/controller#main", "add 1000 points") + print("1000") + self.scored = true + end + end end end +-- if message.group == hash("chest") then +-- if self.holding_key == true then +-- msg.post("chest#sprite1", "enable") +-- msg.post("chest#sprite", "disable") +-- msg.post("main:/controller#main", "add 1000 points") +-- end +-- end + if message.group == hash("key") then + self.holding_key = true + msg.post("level3:/key#sprite", "disable") + msg.post("key_symbol#sprite", "enable") + end end if message_id == hash("curse_dying_reply") then if message.dying == false then diff --git a/main/startscreen.collection b/main/startscreen.collection index e853441..fdce3d3 100644 --- a/main/startscreen.collection +++ b/main/startscreen.collection @@ -40,20 +40,13 @@ embedded_instances { "embedded_components {\n" " id: \"cloud1\"\n" " type: \"sprite\"\n" - " data: \"default_animation: \\\"cloud1\\\"\\n" + " data: \"default_animation: \\\"cloud\\\"\\n" "material: \\\"/builtins/materials/sprite.material\\\"\\n" "textures {\\n" " sampler: \\\"texture_sampler\\\"\\n" " texture: \\\"/main/graphics.atlas\\\"\\n" "}\\n" "\"\n" - " position {\n" - " z: 0.4\n" - " }\n" - " scale {\n" - " x: 1.295998\n" - " y: 1.368312\n" - " }\n" "}\n" "" scale3 {