1
Technical forum / DeleteEntity error, even though code works
« on: September 09, 2012, 11:15:54 AM »
Hi!
I wanted to have an animated sprite in the beginning of the game, without the actor, because it is supposed to be the actor lying down on the ground.
So I decided to load the actor after the sprite have done its job, and so this is what I came up with:
game.script
This works totally fine. But I still get an error saying:
"12:08:26: Runtime error. Script 'scripts\game.script', line 39
12:08:26: Call to undefined method 'DeleteEntity'. Ignored."
It does delete the sprite anyways, because its not there once the scene is loaded again with the actor.
But I'm just thinking it might ruin other things with the game further on, is there something i need to fix so that i do not get the error?
I wanted to have an animated sprite in the beginning of the game, without the actor, because it is supposed to be the actor lying down on the ground.
So I decided to load the actor after the sprite have done its job, and so this is what I came up with:
game.script
Code: [Select]
// which scene to load?
Game.ChangeScene(Game.StartupScene);
//create animated sprite on scene
var wakeupanim= Scene.CreateEntity("wakeupanimation");
wakeupanim.SetSprite("Animations\wakeupscene1.sprite");
wakeupanim.X=280;
wakeupanim.Y=521;
//Let animated sprite animate before fade out
Sleep(5000);
//Delete sprite from scene
wakeupanim.DeleteEntity("wakeupanimation");
Scene.FadeOut(100);
Game.ChangeScene(Game.StartupScene);
//Load main actor
actor = Game.LoadActor("actors\Naomi\Naomi.actor");
Game.MainObject = actor;
This works totally fine. But I still get an error saying:
"12:08:26: Runtime error. Script 'scripts\game.script', line 39
12:08:26: Call to undefined method 'DeleteEntity'. Ignored."
It does delete the sprite anyways, because its not there once the scene is loaded again with the actor.
But I'm just thinking it might ruin other things with the game further on, is there something i need to fix so that i do not get the error?