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 CornDog

I am working on a game where I need to be able to manipulate the pixels of the background image.
I have been doing some testing and I can do this by creating an image using the createImageData() function but I'm not sure how to use this as the background inside of the impact engine. And how I would still have access to modify the image data during the game.

I have been trying some things but so far nothing has worked.

1 decade ago by monkeyArms

What exactly is your goal?

1 decade ago by Arantor

Whatever, this isn't an Impact construct but something provided by the base canvas object. The Drop demo game uses this if you need an example to manually alter pixels.

1 decade ago by CornDog

Thanks I had not yet looked at Drop yet. The code within seems to have answered my question.

1 decade ago by CornDog

IT seems I spoke too soon. I have been fighting with it for a bit now with no success.

I need to be able to edit the colors of the background pixels based upon the position of game events. So if something explodes here, I will add a blotch of blue color to the background image behind it.

So How would I Get Impact to display an array of image data as the background of the Canvas. I can do it with just the canvas an some javascript, but Impact throws in a layer that seems to get in the way.

1 decade ago by monkeyArms

My first thought is don't manipulate pixel data for that - create a "splotch" entity with a png image, and spawn it at the location it needs to be at. I.e. Just overlay a png.

Again, if that won't work I would need more detail

1 decade ago by Arantor

Impact isn't adding any layers at all, end of the day it's still just a regular canvas and you address it as such. The only difference is that Impact stores a reference to it in ig.game somewhere (offhand can't remember what it is)
Page 1 of 1
« first « previous next › last »