跪求!!!请问各位谁有Flash as3.0制作的小游戏源代码啊?
一定要是AS3.0编写的源程序代码哦,小游戏最好是贪食蛇或者拼图(其他的也行)....希望各位高手出手相助~本人邮箱:389744113@qq.com...
一定要是AS3.0编写的源程序代码哦,小游戏最好是贪食蛇或者拼图(其他的也行)....希望各位高手出手相助~
本人邮箱:389744113@qq.com 展开
本人邮箱:389744113@qq.com 展开
2个回答
展开全部
package {
import flash.display.*;
import flash.events.*;
public class MouseToy extends MovieClip {
private var circles:Array;
public function MouseToy() {
// init
circles=[];
for (var i:int=0; i < 30; i++) {
var c:Sprite=makeCircle();
c.x=stage.stageWidth / 2;
c.y=stage.stageHeight / 2;
c.scaleX=1 + i / 2;
c.scaleY=0.5 + i / 4;
addChild(c);
circles.push(c);
}
addEventListener(Event.ENTER_FRAME,onLoop);
}
// private methods
private function onLoop(evt:Event):void {
circles[0].y+= mouseY - circles[0].y / 4;
for (var i:int=1; i < circles.length; i++) {
var pre:Sprite=circles[i - 1];
circles[i].y+= pre.y - circles[i].y / 4;
}
}
private function makeCircle():Sprite {
var s:Sprite=new Sprite ;
with (s.graphics) {
lineStyle(0,0x000000);
drawCircle(0,0,10);
}
return s;
}
}
}
代码给你,怎么用就看你了
import flash.display.*;
import flash.events.*;
public class MouseToy extends MovieClip {
private var circles:Array;
public function MouseToy() {
// init
circles=[];
for (var i:int=0; i < 30; i++) {
var c:Sprite=makeCircle();
c.x=stage.stageWidth / 2;
c.y=stage.stageHeight / 2;
c.scaleX=1 + i / 2;
c.scaleY=0.5 + i / 4;
addChild(c);
circles.push(c);
}
addEventListener(Event.ENTER_FRAME,onLoop);
}
// private methods
private function onLoop(evt:Event):void {
circles[0].y+= mouseY - circles[0].y / 4;
for (var i:int=1; i < circles.length; i++) {
var pre:Sprite=circles[i - 1];
circles[i].y+= pre.y - circles[i].y / 4;
}
}
private function makeCircle():Sprite {
var s:Sprite=new Sprite ;
with (s.graphics) {
lineStyle(0,0x000000);
drawCircle(0,0,10);
}
return s;
}
}
}
代码给你,怎么用就看你了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询