TypeError: Error #1009

HeatBlaze

  • Posts: 1
Hello. As a new coder, I was working on a game and came across a quite frustrating bug while testing out a respawn event. Trying and trying again to create new ways to kill/respawn/increase score, this error keeps occuring when a bullet hits the other player:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at MethodInfo-6338()[Source/scripts/SceneEvents_3.hx:98]
   at com.stencyl::Engine/update()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2381]
   at com.stencyl::Engine/postUpdate()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2583]
   at com.stencyl::Engine/onUpdate()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2576]

Looking online, I found this error occurs when you "attempt to access a property or call a method (function) from an object variable that has no value (undefined) or has a null value"

I checked my behaviors and still have no idea where this is coming from. How would one go about fixing this bug?

Mineat

  • Posts: 324
Did you code the bullet's collision behavior for the player right? That may be it.

Edit: Oh, I see....the type defined in the behavior turns up as a null value when defined elsewhere. Change the collision type of the player to one that can be detected as such. If not, continue seeking help.

« Last Edit: January 11, 2016, 09:43:27 pm by Mineat »

yoplalala

  • *
  • Posts: 1530
i Think it's because when a bullet collides with a player, there are multiple collision points.
so your "kill actor" will occur multiple times, the problem is that for the second collision point your actor will already be dead  ..
put your kill actor inside a if actor is alive it should be good.


Or post a screenshot your bullet/player collision :)