Tutorial - Pickups

70 views
Skip to first unread message

YertleTheTurtle

unread,
Feb 23, 2016, 6:24:05 PM2/23/16
to HaxeFlixel


Hi everyone,

I am on step 8 of the "dungeon crawler" tutorial. When I add the tween to Coin.hx

class Coin extends FlxSprite
{

   
public function new(?X:Float=0, ?Y:Float=0, ?SimpleGraphic:FlxGraphicAsset)
   
{
       
super(X, Y, SimpleGraphic);
        loadGraphic
(AssetPaths.coin__png, false, 8, 8);
   
}
   
   
override public function kill():Void
   
{
        alive
= false;
       
FlxTween.tween(this, { alpha: 0, y: y - 16 }, .33, { ease: FlxEase.circOut, complete: finishKill });
   
}
   
   
private function finishKill(_):Void
   
{
        exists
= false;
   
}
}

and attempt to test it, I receive these errors:

source/Coin.hx:24: characters 53-100 : { ease : t : Float -> Float, complete : _ : Unknown<0> -> Void } has extra field complete
source
/Coin.hx:24: characters 53-100 : For optional function argument 'Options'

Can someone help me spot my error?

Seb Jones

unread,
Feb 23, 2016, 11:08:53 PM2/23/16
to HaxeFlixel
In HaxeFlixel 4 complete in the FlxTween options parameter has been changed to onComplete, so try changing that, like so:

FlxTween.tween(this, { alpha: 0, y: y - 16 }, .33, { ease: FlxEase.circOut, onComplete: finishKill });

Hope this helps :)

YertleTheTurtle

unread,
Feb 24, 2016, 11:39:28 AM2/24/16
to HaxeFlixel
Thank you! This was the solution.

Seb Jones

unread,
Feb 24, 2016, 1:04:09 PM2/24/16
to HaxeFlixel
The HaxeFlixel 4 Upgrade Guide might be worth a check if you run into similar problems in the future. Have fun!
Reply all
Reply to author
Forward
0 new messages