展开全部
//注:不是我编的
//我是用类编的,太复杂
//所以找了一个简单的
var s_x = 0;
var s_y = 0;
var dir = [[-1, 0], [0, -1], [1, 0], [0, 1]];
//四个方向
var _dir;
var c_x = (Stage.width-256)/2;
var c_y = (Stage.height-256)/2;
var map;
var speed;
var level = 1;
var child_num;
var Child;
var snake_arr;
init();
function init() {
speed = 15;
child_num = 1;
snake_arr = [];
DrawOutRound();
//画外框
DrawMap();
//画地图
SnakeRun();
//蛇移动
MakeWall();
//创建障碍物
MakeChild();
//创建食物(后来变成蛇身)
createTextField( "info ", getNextHighestDepth(), 30, 350, 400, 20);
createTextField( "status ", getNextHighestDepth(), 320, 370, 100, 20);
status.text = "状态:playing ";
info.text = "[用方向键控制方向,dead后请点鼠标重新开始]____寒冰制造 ";
}
function DrawBox(name, color, w, h) {
//画方块
var _b = createEmptyMovieClip(name, getNextHighestDepth());
with (_b) {
lineStyle(0);
beginFill(color);
lineTo(w, 0);
lineTo(w, h);
lineTo(0, h);
endFill();
}
return _b;
}
function DrawOutRound() {
DrawBox( "outround ", 0xffffff, 400, 400);
}
function DrawMap() {
var _box = DrawBox( "box ", 0xffffff, 16, 16);
_box._v isible = false;
map = [];
for (var i = 0; i
//我是用类编的,太复杂
//所以找了一个简单的
var s_x = 0;
var s_y = 0;
var dir = [[-1, 0], [0, -1], [1, 0], [0, 1]];
//四个方向
var _dir;
var c_x = (Stage.width-256)/2;
var c_y = (Stage.height-256)/2;
var map;
var speed;
var level = 1;
var child_num;
var Child;
var snake_arr;
init();
function init() {
speed = 15;
child_num = 1;
snake_arr = [];
DrawOutRound();
//画外框
DrawMap();
//画地图
SnakeRun();
//蛇移动
MakeWall();
//创建障碍物
MakeChild();
//创建食物(后来变成蛇身)
createTextField( "info ", getNextHighestDepth(), 30, 350, 400, 20);
createTextField( "status ", getNextHighestDepth(), 320, 370, 100, 20);
status.text = "状态:playing ";
info.text = "[用方向键控制方向,dead后请点鼠标重新开始]____寒冰制造 ";
}
function DrawBox(name, color, w, h) {
//画方块
var _b = createEmptyMovieClip(name, getNextHighestDepth());
with (_b) {
lineStyle(0);
beginFill(color);
lineTo(w, 0);
lineTo(w, h);
lineTo(0, h);
endFill();
}
return _b;
}
function DrawOutRound() {
DrawBox( "outround ", 0xffffff, 400, 400);
}
function DrawMap() {
var _box = DrawBox( "box ", 0xffffff, 16, 16);
_box._v isible = false;
map = [];
for (var i = 0; i
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询