So, learning Pixijs by building a game... created my ship, and it flies around with an asteroid like dynamic, leaving me to track its x and y velocities, if its accelerating, turning, firing, etc. I usually build a class for this, but the following seems to work for my purpose.
let ship = PIXI.Sprite.from('images/sprite.png');
ship.width=50;
ship.height=20;
ship.speed = .2;
ship.rotspeed = .07;
ship.xvel = 0;
ship.yvel = 0;
ship.rotating = 0;
ship.accelling = false;
ship.braking = false;
ship.shooting = false;
This seems to work just fine, and my ship is flying around without issue. Tried searching if this is OK, I mainly find implementations of set/getAttr, creating classes, etc. I haven't tried the same thing with a method yet ( ship.explode = () => {} ) but can almost imagine that will work too. Thoughs? Is this going to lead to problems down the road?