24 lines
811 B
Lua
24 lines
811 B
Lua
-- spinner.lua - Object that spins using a looping cutscene
|
|
-- Tests: onCreate, Cutscene.Play with loop, Cutscene.Stop, Cutscene.IsPlaying,
|
|
-- onInteract, onCollideWithPlayer, Entity.GetRotationY, Timer
|
|
|
|
function onCreate(self)
|
|
Debug.Log("Spinner created, initial rotY: " .. self.rotationY)
|
|
end
|
|
|
|
function onInteract(self)
|
|
if Animation.IsPlaying("anim_spinner") then
|
|
Animation.Stop("anim_spinner")
|
|
setStatus("Spinner stopped!")
|
|
Debug.Log("Spinner stopped at rotY=" .. Entity.GetRotationY(self)
|
|
.. " frame=" .. Timer.GetFrameCount())
|
|
else
|
|
Animation.Play("anim_spinner", {loop = true})
|
|
setStatus("Spinner started!")
|
|
end
|
|
end
|
|
|
|
function onCollideWithPlayer(self)
|
|
Debug.Log("Player touched spinner at frame " .. Timer.GetFrameCount())
|
|
end
|