PDA

View Full Version : Anyone make a photographer game?


spooks
09-08-2008, 04:18 AM
Just wondering if anyone has made or attempted to make a game where you could take pictures in a flash game. I was wondering how you would capture the image that was being displayed in flash at any given time? and I assume you would save the picture as a XML file.. is this possible?

syruplord
09-08-2008, 10:44 PM
Yep it's possible with bitmap data. There was a game i saw on newgrounds.com where you have to photograph fish on a deep sea dive. It was pretty fun and well made, reminded me of pokemon snap ;)

spooks
09-09-2008, 05:34 PM
ah I see. You wouldn't know the code for recording the bitmap would ya? heh.
But as long as I know its possible, i'll keep looking

syruplord
09-09-2008, 10:15 PM
sure thing

let me start by telling you kind of what it does. I'm no expert so this is going to be in laymans terms. Basically bitmapdata works by making a rectangle and filling it with pixels. Note: pixels. These are not vectors so, like if you zoom in it'll be all pixelated and fuzzy.

You make a rectangle, and then take the pixels from whatever is in that rectangle. Here's the code to take whatever is on screen of a 550x400 flash game. If you wanted to, for example, only take stuff from a movie clip like _root.bullets, you'd just change _root.

//AS 2.0
import flash.display.BitmapData;
import flash.geom.Rectangle;
var screenCap = _root.createEmptyMovieClip("mc_screencap", 9999);
screenCap.myBitmap = new BitmapData(550, 400, true, 0x000000);
screenCap.myBitmap.draw(_root);//change _root here to whatever MC you want
screenCap.attachBitmap(screenCap.myBitmap, 0);