Thank you for the information, I’m learning as I go.
So I went back and added the ends you pointed out, but adding one or both now makes defold refuse to run a build. I’m not sure what you mean by using ` to format nicely, I’m afraid.
function init(self)
msg.post(".", “acquire_input_focus”)
msg.post("@render:", “use_fixed_fit_projection”, { near = -1, far = 1 })
self.vel = vmath.vector3() –
end
function update(self, dt)
local pos = go.get_position() –
pos = pos + self.vel * dt –
go.set_position(pos) –
self.vel.x = 0 --
self.vel.y = 0
end
function on_input(self, action_id, action)
if action_id == hash(“up”) then
self.vel.y = 150 –
elseif action_id == hash(“down”) then
self.vel.y = -150
elseif action_id == hash(“left”) then
self.vel.x = -150 –
elseif action_id == hash(“right”) then
self.vel.x = 150
end
end
function on_message(self, message_id, message, sender)
if message_id == hash(“contact_point_response”) then
go.set_position(go.get_position() + message.normal * message.distance)
end
end
end
end
Thank you for your patience.