Hi!
I’m just starting to learn Defold.
First I tried to show an image on screen.
- I put a png file in the “main” folder
- I created an atlas and added a new image with the png reference to it
- I created a game object in the main.collection
- I attached a sprite component to it
- I referenced the atlas and the image to the sprite
- It showed the image when I build the game.
Then I moved the game object (not the sprite position but its parent game object) away from the origin.
Now I’m trying to put back by code a game object at the origin of the main.collection.
I tried this but it didn’t worked :
I created a script and attached it as a file component to the sprite’s game object.
function init(self)
self.zero_vector = vmath.vector3()
go.set_postion(self.zero_vector)
end
So I tried to use the update function to do it :
function update(self, dt)
-- Add update code here
-- Remove this function if not needed
go.set_postion(self.zero_vector)
end
It also didn’t worked.
The error message is as follows :
attempt to call field ‘set_postion’ (a nil value)
I suppose it’s because the go object isn’t recognized.
Am I missing something?
Also, is there a chat community like Discord or irc for Defold?