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

1 decade ago by Nathre

I'm trying to add an animated background to my game. Do You guys know how can i make the background transparent?

1 decade ago by 80bit

Use PNG with alpha transparency as a sprite sheet and place the background as a large sprite? would that work?

1 decade ago by dominic

You can use transparent PNGs for BackgroundMaps as well. Tiles in BackgroundMaps can also be animated. See the animations article.

1 decade ago by Bradley

My background layer is using transparecy, but behind it is always black. 1) How can I change it from black? 2) Can I make it so my html or body element backgrounds show through the transparency? Will that slow things down?

I'm looking all over the place at my css, and it doesn't look like that is affecting anything, so I'm not sure where these settings would be.

1 decade ago by dominic

Set the Game&039;s <2> to #null and instead clear the canvas with the Canvas API&039;s #.clearRect() before drawing anything else. I.e. in your Game&039;s #draw():

draw: function() {
	ig.system.context.clearRect( 0 ,0, ig.system.realWidth, ig.system.realHeight );
	this.parent();
}

This will make the Canvas completely transparent, so that DOM elements behind it will be visible. Depending on the browser, this may have a performance hit, but I don't think it's a big one.

1 decade ago by Bradley

That works. Thanks!

1 decade ago by SlouchCouch

dominic beat me to it but that's what I've been doing. :0
Page 1 of 1
« first « previous next › last »