Hi,
I am trying to make a “DrawSprite();” function.
When I pass an image to the “DrawSprite();” function nothing happens?
Please view below source code and help if you can:
Jesse
coreLogic.js:
var sky;
function SetupGame ()
{
this.add.image(-99999, -99999, 'sky');
DrawSprite('sky', 320, 180, 1.0, 1.0, 0, 255, 255, 255, 255)
coreVisuals.js:
function LoadAllGraphics ()
{
this.load.image('sky', 'assets/sky2.png');
this.load.image('ground', 'assets/platform2.png');
this.load.image('star', 'assets/star.png');
this.load.image('bomb', 'assets/bomb.png');
this.load.spritesheet('dude', 'assets/dude.png', { frameWidth: 32, frameHeight: 48 });
}
function DrawSprite (spriteName, x, y, scaleX, scaleY, rotation, red, green, blue, alpha)
{
spriteName.x = x;
spriteName.y = y;
spriteName.scaleX = scaleX;
spriteName.scaleY = scaleY;
spriteName.rotation = rotation;
// const tint = new Phaser.Display.Color(red, green, blue);
// spriteName.setTint(tint);
// spriteName.setAlpha(alpha / 255);
}