diff --git a/main/level2.script b/main/level2.script index 39c53e9..18bb4a6 100644 --- a/main/level2.script +++ b/main/level2.script @@ -27,9 +27,9 @@ function createamulets(self) vmath.vector3(800,75,0.3), vmath.vector3(100,200,0.3), vmath.vector3(850,325,0.3), - vmath.vector3(400,450,0.3), - vmath.vector3(300,580,0.3), - vmath.vector3(600,600,0.3), + vmath.vector3(380,450,0.3), + vmath.vector3(300,570,0.3), +-- vmath.vector3(600,600,0.3), } for loop=1,5,1 do diff --git a/main/main.script b/main/main.script index 511aa84..4472fc0 100644 --- a/main/main.script +++ b/main/main.script @@ -184,6 +184,9 @@ function on_message(self, message_id, message, sender) elseif message_id == hash("add 1000 points") then self.current_score = self.current_score + 1000 + + elseif message_id == hash("add 10 points") then + self.current_score = self.current_score + 10 elseif message_id == hash("play amulet sound") then sound.play("sound#amulet_sound", {speed = 1, gain = (self.sounds_volume - 547)/(887 - 547)}) diff --git a/main/player.script b/main/player.script index 7c909f1..8514382 100644 --- a/main/player.script +++ b/main/player.script @@ -128,6 +128,7 @@ function init(self) self.mummy_walking = false self.touching_mummy = false + self.scored_jump = false go.set_position(vmath.vector3(100,100,0.2)) end @@ -270,6 +271,8 @@ function update(self, dt) local ladder_up_right = pos + vmath.vector3(24, -32, 0) local ladder_down_left = pos + vmath.vector3(-24, -42, 0) local ladder_down_right = pos + vmath.vector3(24, -42, 0) + local curse = pos + vmath.vector3(0, -70, 0) + local feet = pos + vmath.vector3(0, -36, 0) --msg.post("@render:", "draw_line", { start_point = centre, end_point = platform, color = vmath.vector4(1,0,0,1) }) --msg.post("@render:", "draw_line", { start_point = ladder_up_left, end_point = ladder_up_right, color = vmath.vector4(1,0,0,1) }) @@ -287,6 +290,7 @@ function update(self, dt) self.jumped = false self.speed = 250 self.grounded = true + self.scored_jump = false self.velocity.y = 0 if point.y > -36 then pos.y = pos.y + (point.y + 36) @@ -299,6 +303,14 @@ function update(self, dt) else self.grounded = false end + + --testing points for jumping over curse + local curse_result = physics.raycast(feet, curse, { hash("curse") }) + msg.post("@render:", "draw_line", { start_point = feet, end_point = curse, color = vmath.vector4(1,0,0,1) }) + if curse_result and self.scored_jump == false then + msg.post("main:/controller#main", "add 10 points") + self.scored_jump = true + end local ladder_up_result1 = physics.raycast(ladder_up_right, ladder_up_left, { hash("ladder") }) local ladder_up_result2 = physics.raycast(ladder_up_left, ladder_up_right, { hash("ladder") })