Huww

Sprites not displaying properly

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

Share this post


Link to post
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.

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.