[SOLVED] Problem Score / FadeIn


(I'll tell you what I want, what I really really want) #21

hold up, since I’m polish, I sometimes read english 2 fast, and not fully understand, for what I’m sorry. There was a name conflict with flashpunk.world.count and now it’s sorted.

Just, on my screen now instead of 60 going down on this badboy, I have 4, and then 3. And then it stops.


(Jacob Albano) #22

I just saw the same thing. :blush: You were quicker than I was.

Make sure you’ve replaced all occurrences of count with your new variable name. It’s probably still being used somewhere, so it reports 4 (Entities) and then 3 when the fade-out is removed.


(I'll tell you what I want, what I really really want) #23

That helped! But now (I know, my “but now” is getting pretty old by now :smile:) the counter is going ape shit, it’s just counting from 60 to 0 in what seems to be a second.


(Jacob Albano) #24

No problem. What’s going on here is that it’s being decremented every frame, so (if you’re running at 60 FPS) it’s going to 0 in exactly a second.

You can solve this by using a repeating Alarm tween, or by using a Number instead of a uint to store the counter, and subtracting FP.elapsed from it every frame instead of a whole unit. If you use the latter, you’ll want to call toFixed(0) instead of toString().


(I'll tell you what I want, what I really really want) #25
public var _count:Number;

far further in the galaxy of Betkowski’s chaos:

override public function update():void 
	{
		
		_count -= FP.elapsed

and it’s showing “Nan”.

The only thing I found about Nan is your post on this forum that Nan is default-initialized for Number, like 0 is for uint.


(Jacob Albano) #26

Numbers are default-initialized to NaN (Not a Number), so make sure you initialize it correctly:

public var _count:Number = 60;

I don’t know if you saw my edit, but make sure to use toFixed(0) instead of toString(), or you’ll end up with a lot of decimal numbers.

Edit: Haha, too slow. :wink:


(I'll tell you what I want, what I really really want) #27

Thank you. If not you, I’d probably go nuts. I won’t bother you any more. :smiley:


(Jacob Albano) #28

My pleasure! Good luck with your jam!