69,369
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <graphics.h>
#include <conio.h>
#include <time.h>
/******全局变量******/
#define STEPDISTANCE 6 // 一步的距离。数值越大,移动速度越快
#define JUMPSPEED 10 // 数值越小,跳得越远
#define ROLLDISTANCE 30 // 滚动的总步数。数值越大,滚得越远
/******全局变量******/
int s_v = STEPDISTANCE; //障碍物和人物移动速度
int p_v = JUMPSPEED; //人物跳跃速度
int score = 0; //分数
int max_s = 0;
char keydown; //按键值
/********************/
void move();
void Login();
/*************************************障碍物类****************************************/
// 障碍物
struct zhangai {
int left;
int top;
int right;
int bottom;
int r;
}
s1, s2, s3;
// 障碍物类型
void zhangai_style(struct *ps) {
int a;
srand((unsigned int) time(NULL));
a = rand() % 5 + 1;
switch(a) {
case 0:
case 1:
case 2:
case 3:
case 4:
ps->top = 330;
ps->bottom = 361;
break;
case 5:
ps->top = 260;
ps->bottom = 291;
break;
}