Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

5 years ago by Gamerdrome

Hi,

I apologize if this is an obvious question but I'm really stuck and I've searched the forums for an answer.

So, I have generated a map and associated a collision map to it (much like in the drop game) as so:

this.map = [
[1,2,1,1,2,1,2,1,1,2,1,1,2,1,1,2,1,2,1,1],
[3,4,3,3,4,3,4,3,4,3,3,3,4,3,3,4,3,4,3,4],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[5,5,5,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[5,5,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[5,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
];

this.collisionMap = new ig.CollisionMap( 8, this.map, {} );
this.backgroundMaps.push( new ig.BackgroundMap(8, this.map, 'media/tiles.png' ) );

and in the draw method I'm trying to draw a simple background image


draw: function() {
var titleImage = new ig.Image( 'media/background.png' );
titleImage.draw(0,0);

this.parent();
}

from testing and removing the collision layer, it seems like the 0's in the collision layer are getting drawn as black tiles. It I draw the image after the this.parent then it appears but on top of everything.

What am I doing wrong?

5 years ago by Gamerdrome

Apologies, of course after a day of working on it I figure out my mistake an hour after posting this. On the update I was rending the front layer onto the background layer.
Page 1 of 1
« first « previous next › last »