10 points

This commit is contained in:
Paul Brown 2025-09-07 18:13:09 +01:00
parent a26ea92981
commit 5b21607bd6
3 changed files with 18 additions and 3 deletions

View file

@ -27,9 +27,9 @@ function createamulets(self)
vmath.vector3(800,75,0.3), vmath.vector3(800,75,0.3),
vmath.vector3(100,200,0.3), vmath.vector3(100,200,0.3),
vmath.vector3(850,325,0.3), vmath.vector3(850,325,0.3),
vmath.vector3(400,450,0.3), vmath.vector3(380,450,0.3),
vmath.vector3(300,580,0.3), vmath.vector3(300,570,0.3),
vmath.vector3(600,600,0.3), -- vmath.vector3(600,600,0.3),
} }
for loop=1,5,1 do for loop=1,5,1 do

View file

@ -185,6 +185,9 @@ function on_message(self, message_id, message, sender)
elseif message_id == hash("add 1000 points") then elseif message_id == hash("add 1000 points") then
self.current_score = self.current_score + 1000 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 elseif message_id == hash("play amulet sound") then
sound.play("sound#amulet_sound", {speed = 1, gain = (self.sounds_volume - 547)/(887 - 547)}) sound.play("sound#amulet_sound", {speed = 1, gain = (self.sounds_volume - 547)/(887 - 547)})
elseif message_id == hash("play dying sound") then elseif message_id == hash("play dying sound") then

View file

@ -128,6 +128,7 @@ function init(self)
self.mummy_walking = false self.mummy_walking = false
self.touching_mummy = false self.touching_mummy = false
self.scored_jump = false
go.set_position(vmath.vector3(100,100,0.2)) go.set_position(vmath.vector3(100,100,0.2))
end end
@ -270,6 +271,8 @@ function update(self, dt)
local ladder_up_right = pos + vmath.vector3(24, -32, 0) local ladder_up_right = pos + vmath.vector3(24, -32, 0)
local ladder_down_left = pos + vmath.vector3(-24, -42, 0) local ladder_down_left = pos + vmath.vector3(-24, -42, 0)
local ladder_down_right = 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 = 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) }) --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.jumped = false
self.speed = 250 self.speed = 250
self.grounded = true self.grounded = true
self.scored_jump = false
self.velocity.y = 0 self.velocity.y = 0
if point.y > -36 then if point.y > -36 then
pos.y = pos.y + (point.y + 36) pos.y = pos.y + (point.y + 36)
@ -300,6 +304,14 @@ function update(self, dt)
self.grounded = false self.grounded = false
end 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_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") }) local ladder_up_result2 = physics.raycast(ladder_up_left, ladder_up_right, { hash("ladder") })
if ladder_up_result1 then if ladder_up_result1 then