⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 worm2.h

📁 一个小游戏
💻 H
字号:
//Worm2.h

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>

#define  UP        1
#define  DOWN      3
#define  LEFT      4
#define  RIGHT     2
#define  AHEAD     0
#define  STEP      3
#define  COLOR     14
#define  BACKCOLOR 0
#define  BEGIN     20

extern int grass=BEGIN;


class worm
{
int x;
int y;
float life;
int steps;
float left,right;
float direction;
int color;

public:
worm *pre,*next;
worm(int x1=100,int y1=100,float energy=200,float lef=33.33,float rig=33.33)
{
x=x1;
y=y1;
life=energy/2;
left=lef-((float)random(lef/3*100))/100+lef/6;
right=rig-((float)random(rig/3*100))/100+rig/6;
direction=random(4)+1;
steps=0;
}

float go();
int eat();
void bear();
void die();
~worm(){}
};

float worm::go()
{
int direct;
setcolor(BACKCOLOR);
outtextxy(x,y,"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -