Projektmanagement-Game/public/js/Sprite.js
2021-06-11 07:55:46 +02:00

17 lines
473 B
JavaScript

function Sprite(x, y) {
this.sprite = PIXI.Sprite.from('/img/sprite.jpg');
this.coord_x = x;
this.coord_y = y;
this.getSprite = function () {
this.setSize(this.sprite, sprite_size);
return this.sprite;
};
this.setSize = function (sprite, size) {
sprite.x = this.coord_x * size - size * 0.2;
sprite.y = this.coord_y * size - size * 0.2;
sprite.width = size * 1.5;
sprite.height = size * 1.5;
};
}