Hi, i’m moving my player through an already prepared objects on the stage, when i move my player the camera moves as well, but i’ve noticed that when the camera is moving the other objects are shaking even though they are fixed and not moving.
This is my player class :
public class Player extends PhysicsEntity
{
[Embed(source="../../assets/images/beat.png")]
protected static const PLAYER_ART:Class;
public var sprPlayer:Spritemap = new Spritemap(PLAYER_ART, 400, 300);
private static const moveSpeed:uint = 5;
private static const jumpForce:uint = 40;
private var grav:Number = 8;
private var playerGravity:Number = 1;
private var maxJump:Number = -10
private var _playerVelocity:Number = 8;
public static var flapped:Boolean = false;
public function Player(x:Number, y:Number)
{
this.x = x;
this.y = y;
sprPlayer.add("fly", [0, 1, 2], 20, true);
sprPlayer.add("fall", [4], 20, true);
sprPlayer.scale = .2;
name = "player";
}
override public function added():void
{
graphic = sprPlayer;
sprPlayer.play("fly");
initPlayermask();
Input.define('fly', Key.SPACE, Key.UP);
super.added();
}
private function initPlayermask():void
{
try {
mask = Globals.generateMask(sprPlayer);
}
catch (e:Error) {
trace("error player "+e.message);
}
}
override public function update():void
{
if (Globals.playerAlive) {
this.y += grav;
grav += Globals.playerGravity;
if (Input.pressed(Key.UP) || Input.mousePressed) {
velocity.x = _playerVelocity;
y -= Globals.playerJump;
grav = Globals.playerMaxJump;
}
}
else {
trace("game active false player");
sprPlayer.play("fall");
active = false;
}
super.update();
}
}
This a link to the project, it’s a simple one :