How to get y of an object when override Kill() function



  • Hi! I am trying to follow the tutorial.
    I need to override kill function for coins to make them disappear with animation. The problem here is that the code from the tutorial doesn't work for me. VSCode shows that he doesn't know what is 'y' inside the kill() funciton.

    override function kill()
    	{
    		alive = false;
    		FlxTween.tween(this, {alpha: 0, y: y - 16}, 0.33, {ease: FlxEase.circOut, onComplete: finishKill});
    	}
    

    y from y - 16 is unknown. How I can get it inside the function?



  • Resolved.
    I overrided the function in PlayState class insted of Coin class.
    Moved the functions into right class and fixed the issue.


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.