cykod / Quintus

HTML5 Game Engine
http://html5quintus.com
GNU General Public License v2.0
1.41k stars 400 forks source link

Fixed using image for tile 0 in scene #5

Closed jerone closed 11 years ago

jerone commented 11 years ago

I couldn't use a zero indexed tile image for my scene.

cykod commented 11 years ago

This functionality was needed, but I added two methods in lieu of this (I usually want to use tile 0 to be not drawn instead of undefined as undefined looks bad in a json data file):

// Overload this method to draw tiles at frame 0 or not draw
// tiles at higher number frames
drawableTile: function(tileNum) {
  return tileNum > 0;
},

// Overload this method to control which tiles trigger a collision
// (defaults to all tiles > number 0)
collidableTile: function(tileNum) {
  return tileNum > 0;
},

If you inherit from Q.TileLayer you can control what tiles get drawn and what cause collisions.