Reputation: 6282
In my attempt to create a simple Pong-like game, I've encountered a very strange and at times severe visual bug.
When I set the ball (A Flash CS 5.5 library MovieClip) in motion moving around the screen at a rather fast speed, I've noticed that sometimes the edges of the ball would be cut-off for a short moment in the direction it is moving.
When it happens, it almost seems like the position of the ball
MovieClip is slightly ahead of its own border and thus the part that is outside the border fails to get drawn.
Here's a picture that illustrates how this looks - at least for me:
You can also view the .swf file online here: http://megaswf.com/serve/2099366
Some technical data:
EnterFrame
event function to increment / decrement the x
and y
position of the MovieClip.x
and y
values of the MovieClip
didn't help. Neither did setting cacheAsBitmap
to true.What in the world could be causing this problem?
Thanks in advance.
Upvotes: 3
Views: 489
Reputation: 1154
I was having this same problem, under the same constraints. As I've added content to my game, this has become more of a problem. These options greatly reduce the artifact:
Upvotes: 1
Reputation: 3794
I don't know the exact technical reason for this (I'm guessing it has to do with the screen refresh rate vs FPS) but I'm pretty sure its a screen artifact and not a real rendering bug (which is why you won't be able to get it on a screenshot). You can try several things to decrease the effect, like some kind of motion blur:
//on your game loop
mc.filters = [new BlurFilter(Math.abs(speed.x), Math.abs(speed.y),3)];
Or other visual tweaks... but bare in mind this thing is very noticeable on a black-circle/white-background situation, however on more complex scenarios the eye is much more forgiving.
I'm not sure there is a technical solution (reliable across machines/OSs/browsers), but you can also try with stuff like optimizing your game loop (blitting + steady framerate + updateAfterEvent())... though I'm not sure the result would be as one would like to think (I'm guessing it could help a little).
Upvotes: 0