# Editor issue changing sprite default animation

**URL:** <https://forum.defold.com/t/editor-issue-changing-sprite-default-animation/77019>\
**Category:** Questions\
**Created:** [May 23, 2024, 7:56am UTC](https://forum.defold.com/t/editor-issue-changing-sprite-default-animation/77019 "2024-05-23T07:56:57Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Vampiloup](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vampiloup/32/34713_2.png) [@Vampiloup](https://forum.defold.com/u/Vampiloup)\
**Post date:** [May 23, 2024, 9:27am UTC](https://forum.defold.com/t/editor-issue-changing-sprite-default-animation/77019/3 "2024-05-23T09:27:37Z")

</div>

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 :

```lua
	-- 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).

---

_[View the full topic](https://forum.defold.com/t/editor-issue-changing-sprite-default-animation/77019)._
