FlxTween not displaying? (tutorial)

101 views
Skip to first unread message

bayren

unread,
Jun 15, 2014, 10:22:22 AM6/15/14
to haxef...@googlegroups.com
Hey all,

I'm doing the HaxeFlixel tutorial on the website, and I'm stuck on the Coin tween. In the demo at the start of the series, the tween works fine, but in the version I'm working on, it doesn't display at all. Tested in Flash and Neko, on Windows 7. Here's my code:

class Coin extends FlxSprite {
 
public function new(X:Float=0, Y:Float=0){
   
super(X, Y);
   loadGraphic
(AssetPaths.coin__png, false, 8, 8);
   $type
(finishKill);
 
}

 
override public function kill():Void {
   alive
= false;
   
var _tween:FlxTween = FlxTween.tween(this, { alpha: 0, y: y - 16 }, 1, { ease: FlxEase.circOut, complete: finishKill, type: FlxTween.ONESHOT });
   
super.kill(); //added to see if it would fix anything
 
}

 
private function finishKill(tween:FlxTween):Void {
   exists
= false;
 
}
}

Am I missing something? I've looked at the docs and other examples to see if I had something wrong, and so far I haven't seen much difference.

(also: is there a list somewhere of what Properties are available for tweening? Is it just the values of FlxSprite?)

Thanks for your help!

Gama11

unread,
Jun 15, 2014, 3:07:33 PM6/15/14
to haxef...@googlegroups.com
From the looks of it, this should be working fine, except that added super.kill() defeats the whole point of creating the tween in the first place, as it will set exists = false. What you're doing in finishKill() is basically delaying kill() - so technically, it might be nicer to call super.kill() from there instead.

There is no "list of properties available for tweening", since you can tween any arbitrary variable. You could even tween private ones, as Reflection is used for tween().

bayren

unread,
Jun 15, 2014, 4:54:11 PM6/15/14
to
Ah, that was it! Thank you. I added it while I was fixing a function argument problem, and didn't think to remove it.
Reply all
Reply to author
Forward
0 new messages