Hi all, I am new to Defold and have been practicing with the default demo which has the logo.
I created a separate collection for background so the movement script does not also move the background.
When I run the game
-
first the background does not show
-
second the logo starts at the bottom left edge even though I placed it in middle
How can I fix these 2 things.
function init(self)
msg.post(".", "acquire_input_focus")
self.position = go.get_position()
self.target_position = go.get_position()
end
function update(self, dt)
self.position = vmath.lerp(0.2, self.position, self.target_position)
go.set_position(self.position)
end
function on_input(self, action_id, action)
if action_id == hash("click") and action.pressed then
self.target_position.x = action.x
self.target_position.y = action.y
end
end
Thanks