62 lines
No EOL
1.8 KiB
Text
62 lines
No EOL
1.8 KiB
Text
|
||
ã
|
||
Ë
|
||
|
||
|
||
function init(self)
|
||
sprite.play_flipbook("#sprite", hash("amulet"))
|
||
end
|
||
|
||
function final(self)
|
||
-- Add finalization code here
|
||
-- Learn more: https://defold.com/manuals/script/
|
||
-- Remove this function if not needed
|
||
--print ("Amulet removed")
|
||
end
|
||
|
||
function update(self, dt)
|
||
if self.deleted then
|
||
return -- skip logic if object is flagged for deletion
|
||
end
|
||
end
|
||
|
||
function fixed_update(self, dt)
|
||
-- This function is called if 'Fixed Update Frequency' is enabled in the Engine section of game.project
|
||
-- Can be coupled with fixed updates of the physics simulation if 'Use Fixed Timestep' is enabled in
|
||
-- Physics section of game.project
|
||
-- Add update code here
|
||
-- Learn more: https://defold.com/manuals/script/
|
||
-- Remove this function if not needed
|
||
end
|
||
|
||
function on_message(self, message_id, message, sender)
|
||
if message_id == hash("contact_point_response") then
|
||
if message.group == hash("player") then
|
||
--print ("Collision with player")
|
||
self.deleted = true
|
||
msg.post(self.creator, "amulet_deleted")
|
||
end
|
||
end
|
||
if message_id == hash("creator") then
|
||
self.creator = message.creator
|
||
end
|
||
end
|
||
|
||
function on_input(self, action_id, action)
|
||
-- Add input-handling code here. The game object this script is attached to
|
||
-- must have acquired input focus:
|
||
--
|
||
-- msg.post(".", "acquire_input_focus")
|
||
--
|
||
-- All mapped input bindings will be received. Mouse and touch input will
|
||
-- be received regardless of where on the screen it happened.
|
||
-- Learn more: https://defold.com/manuals/input/
|
||
-- Remove this function if not needed
|
||
end
|
||
|
||
function on_reload(self)
|
||
-- Add reload-handling code here
|
||
-- Learn more: https://defold.com/manuals/hot-reload/
|
||
-- Remove this function if not needed
|
||
end
|
||
@main/amulet.script"
|
||
creator«ÛÃÂýŒ˜ |