-- ============================================================================ -- 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