欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOC文档下载  

    《嵌入式系统导论》课程设计小游戏之小鸡快跑.doc

    • 资源ID:2392526       资源大小:255KB        全文页数:15页
    • 资源格式: DOC        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    《嵌入式系统导论》课程设计小游戏之小鸡快跑.doc

    嵌入式系统导论课程设计名称 小游戏之小鸡快跑姓名院系电气工程系班级电子二班学号时间2014年12月19日目录设计目的-3设计器件-3设计步骤-3仿真步骤与结果-3 1.小鸡行走-62.小鸡停止下坠-6设计程序(部分)-71. 计时器程序-72. 操作程序-8 3. 行走路径程序-94.主程序-12总结-15设计目的:通过过此次实验,让大家更熟visual studio软件的使用。同时通过小组讨论的方式,增强大家的沟通、合作能力。学会在遇到问题时与他人协作的能力。设计器件:计算机一台 visual studio软件设计步骤:1. 确立题目,选择方向2. 进行编写程序3. 打开visual studio软件,加载程序4. 点击运行按钮,进行软件的仿真5. 根据仿真结果进行调试仿真步骤与结果:步骤一步骤二步骤三步骤四步骤五 小鸡行走:小鸡停止下坠:实验程序(部分)计时器程序namespace ChickRun partial class Form1 / <summary> / </summary> private System.ComponentModel.IContainer components = null; / <summary> / </summary> / <param name="disposing"> protected override void Dispose(bool disposing) if (disposing && (components != null) components.Dispose(); base.Dispose(disposing); #region Windows private void InitializeComponent() ponents = new System.ComponentModel.Container(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.timer1 = new System.Windows.Forms.Timer(ponents); (System.ComponentModel.ISupportInitialize)(this.pictureBox1).BeginInit(); this.SuspendLayout(); / / pictureBox1 / this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox1.Location = new System.Drawing.Point(0, 0); this.pictureBox1.Name = "pictureBox1" this.pictureBox1.Size = new System.Drawing.Size(530, 346); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; this.pictureBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseClick); this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint); / / timer1 / this.timer1.Tick += new System.EventHandler(this.timer1_Tick); / / Form1 / this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(530, 346); this.Controls.Add(this.pictureBox1); this.Name = "Form1" this.Text = "Form1" this.Load += new System.EventHandler(this.Form1_Load); this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown); (System.ComponentModel.ISupportInitialize)(this.pictureBox1).EndInit(); this.ResumeLayout(false); #endregion private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Timer timer1; 操作程序:using System;using System.Collections.Generic;using System.Text;using System.Drawing;namespace ChickRun public class Chick public float g = 150.0f; public float speedX; public float speedY = 100.0f; public float dt = 0.1f; public bool IsRuning = false; public bool IsJumping = false; public bool IsSpeeding = false; public bool IsFalling = false; public Bitmap bmp; public Chick() using (Bitmap bmpt = (Bitmap)Bitmap.FromFile("chick.png") bmp = bmpt.Clone() as Bitmap; public void Update() if (!IsRuning) return; if (IsSpeeding) this.point.X += (int)(speedX *2) * dt+0.9); else this.point.X += (int)(speedX * dt+0.9); if (IsJumping | IsFalling) this.point.Y += (int)(-speedY * dt+0.9); speedY -= (int)(g * dt); public Point point; 行走路径程序:using System;using System.Collections.Generic;using System.Text;using System.Drawing;namespace ChickRun public class Road static Random rand = new Random(); public int ItemLen; public List<Image> landbmp = new List<Image>(); public Road(int itemnum, int itemlen) if (itemlen < 2) throw new Exception(); this.ItemLen = itemlen; RoadItem item00 = new RoadItem(0,this.ItemLen); item00.imageIndex = 0; item00.type = 1; _roads.Add(item00); for (int i = 0; i < itemnum-2; i+) int temp = rand.Next(0, 3); int index = 0; int ang = 0; if (temp = 0) ang = -20; index = 2; else if (temp = 1) ang = 0; index = 0; else ang = 20; index = 1; RoadItem item = new RoadItem(ang, this.ItemLen); if (rand.Next(0, 4) = 1) item.type = 0; else item.type = 1; item.imageIndex = index; _roads.Add(item); RoadItem item11 = new RoadItem(0, this.ItemLen); item11.imageIndex = 0; item11.type = 1; _roads.Add(item11); for (int i = 0; i < _roads.Count; i+) RoadItem item = _roadsi; if (i = 0) item.start = new Point(0, 100); else item.start = _roadsi - 1.end; item.end = new Point(item.start.X + item.length, item.start.Y + (int)(Math.Tan(item.angle * Math.PI / 180) * item.length+0.9); using (Image bmp1 = Image.FromFile("land0.png") landbmp.Add(bmp1.Clone() as Image); using (Image bmp2 = Image.FromFile("land20.png") landbmp.Add(bmp2.Clone() as Image); using (Image bmp3 = Image.FromFile("land-20.png") landbmp.Add(bmp3.Clone() as Image); /public int GetY(int x) / / int i = x / ItemLen; / int y = 0; / if (i + 1 < RoadItems.Count) / / RoadItem item = RoadItemsi; / float k = (x - item.start.X) / (float)(item.end.X - item.start.X); / y = item.start.Y + (int)k * (item.end.Y - item.start.Y); / / return y; / RoadItems _roads = new RoadItems(); public RoadItems RoadItems get return _roads; public class RoadItems : List<RoadItem> public class RoadItem public int angle; public int length; public int type;/0为空,1为陆地 public RoadItem(int angle, int length) this.angle = angle; this.length = length; public Point start; public Point end; public int GetY(int x) RoadItem item = this;/ RoadItemsi; float k = (x - item.start.X) / (float)(item.end.X - item.start.X); int y = item.start.Y + (int)(k * (item.end.Y - item.start.Y)+0.9); return y; public int imageIndex = 0; 主程序using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace ChickRun public partial class Form1 : Form public Form1() InitializeComponent(); Scene sc; private void Form1_Load(object sender, EventArgs e) sc = new Scene(pictureBox1 .Size); sc.StateChange += new StateChange(sc_StateChange); sc.Refresh(); void sc_StateChange(int v,float p) if (v = 1) this.Text="跳起" else if (v = 2) jumpNum = 0; this.Text = "落到地面" else if (v = 3) this.Text = "正在下落" else if (v = 4) this.Text = "行走" else if (v = 5) this.Text = "下坠" else if (v = 6) this.Text = "停止下坠game over" else if (v = 7) this.Text = "停止,到达终点" this.Text+=""+(int)(p*100)+"%" private void pictureBox1_Paint(object sender, PaintEventArgs e) if (sc = null) return; e.Graphics.DrawImage(sc.bitmap, new Point(0, 0); private void pictureBox1_MouseClick(object sender, MouseEventArgs e) timer1.Enabled = !timer1.Enabled; if (timer1.Enabled) sc.chick.IsRuning = true; private void timer1_Tick(object sender, EventArgs e) sc.Refresh(); pictureBox1.Refresh(); int jumpNum = 0; private void Form1_KeyDown(object sender, KeyEventArgs e) if (e.KeyData = Keys.Space) if (sc.currentRoadsIndex + 1 = sc.road.RoadItems.Count) return; jumpNum+; if (jumpNum > 2) return; sc.chick.speedY = 150; sc.chick.IsJumping = true; else if (e.KeyData = Keys.S) if (sc.chick.IsRuning) sc.chick.IsSpeeding = true; /+5+1+a+s+p+x private void Form1_KeyUp(object sender, KeyEventArgs e) if (e.KeyData = Keys.S) if (sc.chick.IsRuning) sc.chick.IsSpeeding = false; 总结:众所周知,ARM 微处理器功能特别的强大,与 MC51 单片机相比,它更适合做中高端数字系统的微处理器,ARM 已经成了现代主流微处理器内核,目前,绝大多数码产品,如,手机,MP3,MP4,数码相机,他们的系统都嵌 入了 ARM系列内核, ARM 微处理器更新换代很快, 现在的诺基亚 N 系列智 能手机如 N78,N79 已经采用了 ARM11 了,使得运行于塞班操作系统 S60 第 三版的应用程序流畅自如,基于 ARM的强大功能,我们没有理由不学 ARM,而我们现在学的仅仅是 ARM7 或 LPC2000 系列的一点皮毛,有大把知识需 要自学才能掌握,兴趣是最好的老师,只要你爱 ARM,ARM 也会爱你的,通过这次实验的设计,我们对 ARM 有了以下的了解:1,初步了解了 LPC2138 系列的硬件结构;2,了解了 LPC2138 引脚的大致功能;3,掌握 GPIO 口;4,相关寄存器的名称和使用功能;5,熟悉基于 C 语言的 ARM 初始化程序和功能模块编程;6,掌握 PWM 的初始化及歌曲简谱节拍和音乐输出实验程序的编写。但是在完成这次实验的时候,由于对ADS软件不熟悉和对C语言掌握不够牢固,我们遇到了很多的困难,有时一个小问题都会让我们抓狂郁闷很久。但正是这种经历,让我们更好地掌握了自学能力,也学会了运用团队的力量,在今后的学习中,我们会扬长避短,争取做得更好

    注意事项

    本文(《嵌入式系统导论》课程设计小游戏之小鸡快跑.doc)为本站会员(laozhun)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开