person.h

来自「自己编的一个游戏魂斗罗-宠物精灵版」· C头文件 代码 · 共 45 行

H
45 行
字号
#ifndef _Person_H
#define _Person_H

#include"stdafx.h"

class Person
{
protected:
    int hp;
	int x,y;
	RECT r;

    
public:
	Person(){hp=1;x=0;y=0;}
	Person(int h){hp=h;x=0;y=0;}
	~Person(){}
	int gethp()const {return hp;}
	void goright(int d){x+=d;}
	void goleft(int d){x-=d;}
	void goup(int d){y-=d;}
	void godown(int d){y+=d;}
	int getx()const {return x;}
	int gety()const {return y;}
    void setpos(int a,int b)
	{
		x=a;
		y=b;
	}
	RECT * getrect()
	{
		return &r;
	}
	void setrect(int left,int right,int top,int bottom)
	{
		r.right=right;
		r.left=left;
		r.top=top;
		r.bottom=bottom;
	}
	void getshooted(){hp--;}
};


#endif

⌨️ 快捷键说明

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