Game Development Community

What's the best way to refer to the player?

by sqldbatx · in TGB Platformer Kit · 08/05/2009 (2:42 pm) · 3 replies

I'm sure this is a pretty easy question.


Should I set $player in the onAddtoScene in the PlayerMethods.cs?

I'm sure there has to be a better way...


I'm trying to use some of the resource behaviors and they don't really fit into the PSK because you don't add the player to the gui, you add a spawnpoint.

#1
08/05/2009 (6:46 pm)
Yup, that is the way that I would do it. Either that or inside the ControllerBehavior::onAdd method.
#2
08/06/2009 (6:38 am)
Is there any cleanup that needs to happen later, like:

$player = nothing;


?



Thanks so much!
#3
08/06/2009 (11:33 am)
I would guess you'd need something like $player.safeDelete(); ?