基于MSP430的LCD1284赛车小游戏开发(3)

2019-08-31 14:36

u8

car2_position[20]={45,18,63,80,22,30,45,17,25,30,40,50,60,70,50,32,58,77,17,65};//17~83 int main(void) {

WDTCTL = WDTPW | WDTHOLD;// Stop watchdog timer

unsigned char

direction,speed,temp,temp_car2=0;

Sys_Clk_Init();//时钟初始化,现在为20MHz Init_LCD(); Init_key();

update_to_LCD(x,y,car,2,12); show_others(); LCD_Draw_Pic(LCD);

while(1) {

if(temp_car2==19) {

temp_car2 = 0; } //car2 回归初始位置

if(car2_x>64) {

temp_car2++;

car2_y=car2_position[temp_car2], car2_x=1; } //新的一辆车的位置

direction=test_direction(); speed=test_speed(); if(speed == 0) {

update_speed(speed); }

if(speed == 1) {

update_speed(speed); for(temp=speed;temp>0;temp--) {

update_fraps_some(1,16); update_fraps_some(95,110);

update_to_LCD(car2_x,car2_y,block,2,12); car2_x++;

show_car2(car2_x,car2_y); } }

if(speed == 2) {

update_speed(speed); for(temp=speed;temp>0;temp--) {

update_fraps_some(1,16); update_fraps_some(95,110);

update_to_LCD(car2_x,car2_y,block,2,12); car2_x++;

show_car2(car2_x,car2_y); } }

if(speed == 3)

{

update_speed(speed); for(temp=speed;temp>0;temp--) {

update_fraps_some(1,16); update_fraps_some(95,110);

update_to_LCD(car2_x,car2_y,block,2,12); car2_x++;

show_car2(car2_x,car2_y); } }

if(speed == 4) {

update_speed(speed); for(temp=speed;temp>0;temp--) {

update_fraps_some(1,16); update_fraps_some(95,110);

update_to_LCD(car2_x,car2_y,block,2,12); car2_x++;

show_car2(car2_x,car2_y); } }

if(direction == 1) //控制车的方向向左,把车的位置向左移动1 {

update_to_LCD(x,y,block,2,12); //先把原位置的图案清空 y=y-2;

if(y<=16) y=17; }

if(direction == 2) //控制车的方向向右,把车的位置向右移动1 {

update_to_LCD(x,y,block,2,12); //先把原位置的图案清空 y=y+2;

if(y>=84) y=83; }

update_to_LCD(x,y,car,2,12);//把当前车的位置更新上去


基于MSP430的LCD1284赛车小游戏开发(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:(给力下载)2012江苏省专业技术人员信息化素质模拟题(8)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: