Editor issue changing sprite default animation

What I do is using a Factory, and that’s the script I put in the Object the factory create that decide what properties it have, like name or sprite :

	-- Create rotation of star
	local vitesse = math.random(1, 10)
	self.speed = vitesse
	go.animate(".", "euler.z", go.PLAYBACK_LOOP_FORWARD, 360, go.EASING_LINEAR, 60/self.speed)

	-- Set colour of star
	local couleur = math.random(1,7)
	couleur = liste_etoiles[couleur]
	msg.post("#sprite", "play_animation", {id = hash(couleur)})
	lua_ecrire_systeme(self.id, "couleur", couleur)

	-- Give it a name
	local name = systeme_nom_liste[self.id]
	lua_ecrire_systeme(self.id, "nom", name)

lua_ecrire_systeme is a function that write in a global Table the data of the Object, here the stars systems in a 4X I 'm working on. The function is in a LUA script the Object script don’t even have to call for… reason (maybe because the script that call the factory already do it, I don’t know).

1 Like