This commit is contained in:
Jan Racek
2026-03-29 09:34:46 +02:00
commit 1fdb223f5d
113 changed files with 17499 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
-- ============================================================================
-- collectible.lua - Pickup item
-- ============================================================================
-- Tests: onCreate, onDestroy, onCollideWithPlayer, onEnable, onDisable,
-- Entity.SetActive, Audio.Play, Persist, self.active, self.position
local collected = false
function onCreate(self)
collected = false
Debug.Log("Collectible created at " .. self.position.x .. "," .. self.position.y .. "," .. self.position.z)
end
function onDestroy(self)
Debug.Log("Collectible destroyed")
end
function onEnable(self)
Debug.Log("Collectible enabled")
end
function onDisable(self)
Debug.Log("Collectible disabled")
end
function onCollideWithPlayer(self)
if collected then return end
collected = true
Audio.Play("collect", 127, 64)
-- Update score via scene script global
addScore(100)
setStatus("Collected! +100 points")
Entity.SetActive(self, false)
end