网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
graphics.lineTo(30,-40);
graphics.lineTo(30, -30);
graphics.lineTo( -60, -30);
flag = 39;
}
public function drawLeft():void {
graphics.lineStyle(3,0x00ff00);//右面
graphics.moveTo(60,-30);
graphics.lineTo(60,30);
graphics.lineTo(-30, 30);
graphics.lineTo(-30,40);
graphics.lineTo(-60, 0);
graphics.lineTo(-30,-40);
graphics.lineTo(-30, -30);
graphics.lineTo(60, -30);
flag = 37;
}
public function drawUp():void {
graphics.lineStyle(3,0x00ffff);//上面
graphics.moveTo(-30,60);
graphics.lineTo(30,60);
graphics.lineTo(30, -30);
graphics.lineTo(40,-30);
graphics.lineTo(0, -60);
graphics.lineTo(-40,-30);
graphics.lineTo(-30, -30);
graphics.lineTo( -30, 60);
flag = 38;
}
public function drawDown():void {
graphics.lineStyle(3,0x001177);//下面
graphics.moveTo(-30,-60);
graphics.lineTo(30,-60);
graphics.lineTo(30, 30);
graphics.lineTo(40,30);
graphics.lineTo(0, 60);
graphics.lineTo(-40,30);
graphics.lineTo(-30, 30);
graphics.lineTo( -30, -60);
flag = 40;
}
}
}
再建一个控制类Main.as 用来控制游戏
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Keyboard;
public class Main extends Sprite
{
public var arr:Array;//储存下落箭头的数组
public var time:uint;
public var errorTxt:TextField;//错误显示文本
public var trueTxt:TextField;//正确显示文本
public var levelTxt:TextField;//等级文本
public var meTxt:TextField;//作者文本
public var errorCount:int = 0;//错误总计变量
public var trueCount:int = 0;//正确总计变量
public var levelCount:int = 1;//当前关卡等级
public var speed:uint = 5; //箭头移动速度
public function Main(){
init();
}
public function init():void{
this.addEventListener(Event.ENTER_FRAME,loopHandler);
stage.addEventListener(KeyboardEvent.KEY_DOWN,downHandler);
arr = new Array();
time = 0;
errorTxt = new TextField();
trueTxt = new TextField();
levelTxt = new TextField();
meTxt = new TextField();
errorTxt.text = "失手: "+errorCount;
trueTxt.text = "得分: " + trueCount;
levelTxt.text = "等级: " + levelCount;
meTxt.text = “卫哥作品”;
levelTxt.x = 50;
levelTxt.y = 50;
errorTxt.x = 50;
errorTxt.y = 150;
trueTxt.x = 50;
trueTxt.y = 250;
meTxt.x = 700;
meTxt.y = 550;
this.addChild(errorTxt);
this.addChild(trueTxt);
this.addChild(levelTxt);
this.addChild(meTxt);
}
public function downHandler(event:KeyboardEvent):void{
errorCount++;
if (errorCount >= 10) {
stage.removeEventListener(KeyboardEvent.KEY_DOWN, downHandler);
this.removeEventListener(Event.ENTER_FRAME,loopHandler);
}
for(var i:Number = arr.length-1;i>=0;i–){
//判断键盘按下的键值是否和场景里的字母符合.如果符合则消去
var baby:Baby = arr[i] as Baby;
if ( baby ){
if(baby.flag == event.keyCode){
this.removeChild(arr[i]);
arr.splice(i,1);
trueCount++;
errorCount–;
break;
}
}
}
if (trueCount >= 30) {
levelCount++; //级数升级,得手清零
speed += 3; //级数升级,速度增大,难度增大
trueCount = 0;
}
errorTxt.text = "失手: "+errorCount;
trueTxt.text = "得分: " + trueCount;
levelTxt.text = "等级: " + levelCount
}
public function loopHandler(event:Event):void{
time++;
if(time>=10){
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上鸿蒙开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
链图片转存中…(img-aNG29VLG-1715618664979)]
[外链图片转存中…(img-aJU6uxod-1715618664980)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上鸿蒙开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新