q5js/q5.js

Bug with transparency in sprites in version 1.9x

Mikhail-Barinov opened this issue · 1 comments

Code:

var player;

function preload() { 
  new Canvas("2:5"); 
   
  player = new Sprite(100,100);  
  //player.spriteSheet = loadImage("questKid.png");
  player.spriteSheet = "https://p5play.org/learn/assets/questKid.png";
  player.w = 32;
  player.h = 32;    
}

function setup() {	 
  background("blue"); 

  player.addAnis(
    {
      right:{row:0, frames: 8},
      left:{row:1, frames: 6},      
      down:{row:2, frames: 5},
      up:{row:3, frames: 7},      
      kuv:{row:4, frames: 8},      
    }
  )    
}

function draw() {
  clear();
  background("blue"); 

	if (kb.presses("r")) player.changeAni("right");
	if (kb.presses("j")) player.changeAni("left");
	if (kb.presses("l")) player.changeAni("down");
	if (kb.presses("t")) player.changeAni("up");
	if (kb.presses("s")) player.changeAni("kuv");  
}

If you use version q5.js 1.9.9:
sprite

If you use version q5.js 1.8.7:
sprite2

That was an issue in v1.9.8. Try using the latest version of q5: v1.9.15