I want:
if myobject.position.x == 100 {
myobject.position.x = - 1
else if myobject.position.x == 0
myobject.position.x = +1
}
like i loop
How i can do that in Defold.
I want:
if myobject.position.x == 100 {
myobject.position.x = - 1
else if myobject.position.x == 0
myobject.position.x = +1
}
like i loop
How i can do that in Defold.
You probably want other conditions like pos.x < 100
but:
function update(self, dt)
local pos = go.get_position()
if pos.x == 100 then
pos.x = pos.x - 1
elseif pos.x == 0 then
pos.x = pos.x + 1
end
go.set_position(pos)
end
@SaadiSayβalso, if you want to see some code examples of how to do basic things in Defold, check out the Defold Examples section.
ok, thanks)