Jump to content

Issue regarding scaling of sprite


runeater
 Share

Recommended Posts

I'm learning how to use javascript as well as pix.js to make simple games, however I am running into an issue while scaling buttons for my menu.

Below is what I am working with right now, button0 fails to show up only when I attempt to scale it button1 shows up just fine in the below code segment. Does anyone know why this may be occuring? 

var button0 = new PIXI.Sprite.fromImage("Assets/buttons/play.png");
	var button1 = new PIXI.Sprite.fromImage("Assets/buttons/highscores.png");
	var button2 = new PIXI.Sprite.fromImage("Assets/buttons/shop.png");
	var button3 = new PIXI.Sprite.fromImage("Assets/buttons/options.png");
	var button4 = new PIXI.Sprite.fromImage("Assets/buttons/exit.png");

button0.scale -= 0.5;
	button0.interactive = true;
	button0.on("mousedown", startPress);
	button0.position.set(50, 100);
	stage.addChild(button0);
	
	button1.interactive = true;
	button1.on("mousedown", highscoresPress);
	button1.position.set(50, 200);
	stage.addChild(button1);

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...