Can't test games?

Thunder35

  • Posts: 11
Hey!

I've been having a problem playing my games lately. When I press test game it goes on like normal, but when I hit the play button on my main screen the screen goes black and a popup appears with this message: TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at stencyl.api.engine::GameState/createActor()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/GameState.as:938]
   at stencyl.api.engine::GameState/loadActors()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/GameState.as:779]
   at stencyl.api.engine::GameState/loadScene()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/GameState.as:547]
   at stencyl.api.engine::GameState/enterScene()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/GameState.as:447]
   at stencyl.api.engine::GameState/update()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/GameState.as:1464]
   at org.flixel::FlxGame/update()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/flixel/org/flixel/FlxGame.as:407]



The same thing happens when I publish it to SWF. I haven't tried the other formats yet, though. It seems like it came on overnight, because I had not made any big changes to the game before this. The last thing that I had done before this error started was delete an actor (it was a menu button) that had no behaviors attached to it just yet. Being I deleted the actor before deleting it from the scene, could this have caused the problem?

In the error it mentions API (stencyl.api.engine), so I thought it may have been something wrong with the Kongregate API blocks I'd used, but I deactivated all of them before testing the game, and the game was working fine even with those blocks in it.

So yeah, I don't know what to do. I've looked on the forums and found a couple problems that seemed to be similar. On one there was a suggestion to reinstall Stencyl. I'm all for trying that, as long as my projects will not be carried over to the reinstalled/next version of Stencyl and not deleted. Any help would be appreciated! I've never had this problem before.

dtrungle

  • Posts: 1938
Hey Thunder, you mention deleting an actor so the problem is most likely due to that. Check your behaviors/events and you should find a create actor block that is referencing the deleted actor, or even a blank create actor block. Since this is happening on the first scene load I suggest checking the behaviors/events for that scene. Then check for actor behaviors/scenes that are created when the scene starts up.

I reccommend creating multiple files of your project. Clicking File -> Save As and appending something like _999 will work.

Thunder35

  • Posts: 11
Thanks for getting back to me dtrungle! Because of your advice I found the solution to my problem! The problem was actually in the scene behaviors. I had two Kongregate API setup blocks in my game, one in the bootup screen and another in the level select screen. I guess you can't have two of them in the same game, cause when I got rid of one of them, the error stopped occurring.  :)

I can finally get back to working, and most importantly testing, my games! Thanks again for your help dtrungle, you saved the day!

« Last Edit: February 25, 2013, 10:43:42 pm by Thunder35 »