Jump to content

setScale on staticGroup seems to mess up collision


chadananda
 Share

Recommended Posts

My very first project (Bayan Breakout - Bayan is my 5yr-old who did the artwork).

I did what I thought was safe: grabbed a simple example (breakout) and changed out the images. The problem is that my bricks were quite a bit bigger than the ones I was replacing, so I simply added "SetScale" to fix.

Looks great but the collisions are way off. What am I misunderstanding?

CodePen:   https://cdpn.io/RBeVzo

Relevant section: 

this.bricks = this.physics.add.staticGroup({
  key: 'assets', frame: [ 'brick-yellow.png', 'brick-blue.png', 'brick-green.png',
       'brick-purple.png', 'brick-grey.png', 'brick-orange.png'],
  frameQuantity: 10,
  gridAlign: { width:10, height:6, cellWidth:64, cellHeight:42, x:0, y:50},
  setScale: {x:.16, y:.16} // to size my bricks
}) 

 

 

sshot.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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