Inside my PlayerBehavior class I have:
class PlayerBehavior extends Sup.Behavior {
public playerCol = this.actor.arcadeBody2D;
speed = 0.3;
jumpSpeed = 0.45;
public health = 100;
From inside EnemyBehavior, I want to check colission with just the player and lower his health.
For this I have:
if(Sup.ArcadePhysics2D.collides(this.actor.arcadeBody2D, Sup.getActor("Player").getBehavior(PlayerBehavior).playerCol))
{
Sup.getActor("Player").getBehavior(PlayerBehavior).LowerHealth(1);
}
However, the screen goes dark when I try this. What am I doing wrong?
Kind regards.