Re-send video game control tutorial second bullet

Source: Internet
Author: User
Tutorial | Control effect:

Click here to download the source file


var My_cam:camera = Camera.get ();//create My_cam get camera info
My_video.attachvideo (My_cam);//my_video video accepts and displays camera content
//
_root.map = new Flash.display.BitmapData (0)/Set BitmapData
_root.map._width=320;
_root.map._height=240;
_root.fake.attachbitmap (map, 0, "Auto", true);//fake Receive map content
balls = [];
BALLS[1] = _root["Ball" +1];
_root.onenterframe = function () {
_root.map.draw (My_video)//redraw My_video to map
var clr = _root.map.getpixel (balls[1]._x, balls[1]._y);//get pixel pixel value
Trace (CLR);
Trace ("0x" + clr.tostring (16));//convert pixel value to 16-bit
BALLS[1].OUTCLR = CLR;
if (clr>6579047) {
Balls[1].kill ();//Trigger
}
}; This way can realize the specific positioning of video control, direction and so on, but will be webcam quality and background lighting, the environment, the specific game design, proposed to add dynamic gain color.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.