vendredi 25 décembre 2015

as3 - movieclip flickers when flipping it horizontally?

When I move my cursor, the player flips from left to right as expected. However, when I keep my cursor still in the middle of the screen (not moving cursor but, instead the player using "WASD" keys), and make my player move towards the cursor and walk past it. Then the player will change scale to horizontal. However, just before it changes scale, the children (player's arms, turret) inside the player flickers to scaleY before changing horizontal scale.

This is my code located inside the container of the player, it's the "PageOne" class.

if (mouseX > player.x)

            player.playerStand.scaleX = 1;
            player.turret.scaleY = 1;
            player.armBottom.scaleY = 1;
            player.armTop.scaleY = 1;
            crosshair.x = mouseX;

        else if (mouseX < player.x)

            player.playerStand.scaleX = -1;
            player.turret.scaleY = -1;
            player.armBottom.scaleY = -1;
            player.armTop.scaleY = -1;
            crosshair.x = mouseX;

So, I am trying to make it so the player's children do not flicker before flipping horizontally and instead instantly change horizontal shape. The movieclip that has ScaleX does not flicker, but the children that use scaleY has this flickering issue. It may be a bit hard to understand by reading so I added a file below.

Here is the file:

Aucun commentaire:

Enregistrer un commentaire