Jump to content

Sprites not displaying properly


Huww
 Share

Recommended Posts

Hey, so I was testing out some stuff for a possible game Idea I have which involves having a 'wall' of randomly jumbled blocks in it.

 

I've only been learning javascript for a very short amount of time and only used Phaser as of today.

I managed to create this 'wall' using the below code (feel free to point out any mistakes or improvements I could make):

for (i=0;i<gridX.length;i++){              for (j=0;j<gridY.length;j++){                  this.game.add.sprite(gridX[i], gridY[j],blocks[Math.floor((Math.random()*blocks.length))]);              }          }     

This wasn't the problem, the problem occurs when the blocks 'spawn'. Each block should have a black 1 pixel thick border, however some only have partial borders or nothing at all, more noticeably the pink and orange blocks.

kSOXRu3.png

Any help would be greatly appreciated.

 

Thanks!

 

 

EDIT: I spread them out more and can now see black on all sides, however the bottom and left sides all seem darker/more visible still?

 

fEIBvwG.png

Link to comment
Share on other sites

Yeah that's fine. It only really makes a difference in WebGL mode anyway.

 

Is your canvas being displayed at the right size? I mean are you passing in a fixed value to the game constructor? (like in the way all the examples use 800x600). Is your game being stretched / expanded at all?

 

Also which browser? Maybe try uploading it somewhere and post here, could iron out if this is local to a bigger issue.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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