资源预览内容
第1页 / 共14页
第2页 / 共14页
第3页 / 共14页
第4页 / 共14页
第5页 / 共14页
第6页 / 共14页
第7页 / 共14页
第8页 / 共14页
第9页 / 共14页
第10页 / 共14页
亲,该文档总共14页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
AS 3.0 :TittupFrog() / Set main variables var moving = false; var falling = false; var clearing = false; var moved = false; var fallen = false; var cleared = false; var movingState = false; var fallingState = false; var clearingState = false; const Height = 8; const Width = 9; const FrameX = 65; const FrameY = 80; const UnitLine = 30; const limit = 4; const speed = 7.5; const None = 0; const reachable = 2; const normal = 1; var grade = 0; var selectedX = -1,selectedY = -1; var block_array = ; var board_array = ; var stone_array = ; / Print of Score var nums_array = ; function setGrade(g) if (grade = 9999) return; grade = g; if (grade = 9999) grade = 9999; if (grade = len; i-) nums_arrayi.gotoAndStop(“num0“); / Set basic backgrounds; function drawBackdrop() var bd = new Backdrop(); bd.width = stage.width; bd.height = stage.height; addChild(bd); function drawScore() var scoreX = 310; var scoreY = 295; var UnitNum = 20; var separation = 10; var score = new Score(); addChild(score); score.x = scoreX; score.y = scoreY; for (var p = limit - 1; p = 0; p-) var num = new NumImg(); addChild(num); nums_array.push(num); num.x = score.x + score.width + separation + p * UnitNum; num.y = score.y; function drawTitle() var TitleX = 300; var TitleY = 90; var title = new Title(); addChild(title); title.x = TitleX; title.y = TitleY; title.addEventListener(MouseEvent.CLICK, release); function release(event) navigateToURL(new URLRequest(“mailto:tittupfrog163.com“), “_blank“); function drawBlocks() for (var i = 0; i = 0 function judgeVertical(h, w) var current = board_arrayhw; var sum = 1; var data = ; for (var i = h - 1; ; i-) if (!withinBorder(i, w) break; if (board_arrayiw != current) break; sum+; data.push(i, w); for (i = h + 1; ; i+) if (!withinBorder(i, w) break; if (board_arrayiw != current) break; sum+; data.push(i, w); return (sum = 3) ? (data) : (); function judgeEach(i, j) / Each orientation of detection const EachCon = new Point(-1, 0), new Point(1, 0), new Point(0, -1), new Point(0, 1); const EachSep = new Point(-2, 0), new Point(2, 0), new Point(0, -2), new Point(0, 2); / Up Connected and Separatedconst UpCon = new Point(-2, -1), new Point(-3, 0), new Point(- 2, 1); const UpSep = new Point(-1, -1), new Point(-1, 1); / Down Connected and Separated const DownCon = new Point(2, -1), new Point(3, 0), new Point(2, 1); const DownSep = new Point(1, -1), new Point(1, 1); / Left Connected and Separated const LeftCon = new Point(-1, -2), new Point(0, -3), new Point(1, -2); const LeftSep = new Point(-1, -1), new Point(1, -1); / Right Connected and Separated const RightCon = new Point(-1, 2), new Point(0, 3), new Point(1, 2); const RightSep = new Point(-1, 1), new Point(1, 1); const ConColl = UpCon, DownCon, LeftCon, RightCon; const SepColl = UpSep, DownSep, LeftSep, RightSep; var current = board_arrayij; for (var d = 0; d = 2) cleanStone(ox, oy); for (var i in h) cleanStone(hi0, hi1); hasVanished+; hasVanished+; if (v.length = 2) cleanStone(ox, oy); for (i in v) cleanStone(vi0, vi1); hasVanished+; hasVanished+; if (hasVanished != 0) cleanStone(ox, oy); setGrade(grade + 5 * hasVanished); fall(); return hasVanished; function enrich() for (var i = 0; i Height; i+) for (var j = 0; j Width; j+) if (board_arrayij = None) produceNewStone(i, j); if (!playable() reset(null); else toPerish(); function toPerish() var done = false; for (var i = 0; i Height; i+) for (var j = 0; j Width; j+) if (vanish(i, j) != 0) done = true; return done; function fall() var interval = 10; function fallUnit(gem) if (gem = null) return; gem.addEventListener(Event.ENTER_FRAME, enterFrame); var count = 0; function enterFrame(e) falling = true; gem.y += UnitLine / interval; if (+count = interval) gem.locationY+; falling = false; enrich(); gem.removeEventListener(Event.ENTER_FRAME, enterFrame); for (var h = 0; h Height; h+) for (var i = 0; i Width; i+) for (var j = 0; j Width - 1 - i; j+) if (board_arrayhj + 1 board_arrayhj board_arrayhj + 1 = board_arrayhj; board_arrayhj = None; stone_arrayhj + 1 = tmpTarget; stone_arrayhj = null; if (tmpTarget != null) fallUnit(tmpTarget); / Animation function zoomIn(stone) stone.scaleX = stone.scaleY = 0.01; stone.addEventListener(Event.ENTER_FRAME, enlarge); function enlarge(e) moving = true; if (stone.scaleX = 1 stone.removeEventListener(Event.ENTER_FRAME, enlarge); else stone.scaleX += 0.11; stone.scaleY += 0.11; function parabola(stone) if (stone = null) return; var vHorizonal = Math.random() * 30 - 15, vVertical = 0, gravity = 3; stone.addEventListener(Event.ENTER_FRAME, ani); function ani(event) clearing = moving = true; stone.x +=
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号