1 decade ago by dmen
So, I have a function that populates the screen - it is called from init(), and then later on from elsewhere. Inside of this function I do like var sky = ig.game.spawnEntity(EntitySky, 0, 0, { level: lvl });
When I call this again, later on, I get a new sky entity on top of the old one - instead of replacing the old one. This probably makes sense if you're up to speed on scope in js but I am still learning. If I change the var sky to this.sky will that take care of it? Or do I really need to kill() the first one before creating a new one? Sorry, just thinking about this (lol) and can't test so I thought I'd post.
When I call this again, later on, I get a new sky entity on top of the old one - instead of replacing the old one. This probably makes sense if you're up to speed on scope in js but I am still learning. If I change the var sky to this.sky will that take care of it? Or do I really need to kill() the first one before creating a new one? Sorry, just thinking about this (lol) and can't test so I thought I'd post.