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

📄 blockdata.h

📁 用VC在BREW平台上开发的手机游戏Superball的源代码
💻 H
字号:
#ifndef __BLOCKDATA__H__
#define __BLOCKDATA__H__

#include "AppFrame.h"
#include "Sprite2D.h"
#include "AEEGraphics.h"

#define ARRAY_ROW  8
#define ARRAY_COL  8
#define BLOCK_TYPE 12

#define NORTHEAST  0
#define NORTHWEST  1
#define SOUTHEAST  2
#define SOUTHWEST  3

#define KEY_SELECT    0
#define KEY_LEFT      1
#define KEY_RIGHT     2
#define KEY_UP        3
#define KEY_DOWN      4 

#define MAPNUM     12

struct item : public BREWObj
{
	int16 cx;			//// x coordinate of the center of item
	int16 cy;			//// y coordinate of the center of item
	uint8 specify;		//// specify means radius for ball, width for board, type for block
	uint8 speed;		//// running speed of each item
	uint8 dir;			//// moving direction of each item, no need for blocks
	int8  picindex;		//// sprite's index;
	uint8 status;		//// each item has different status 
	int8  row;			//// row and col means the position of item in the array 	
	int8  col;			//// board doesn't need row and col	
	SpriteModel sm;		//// each item has a sprite model
};

class BlockApp;

class BlockData : public AppData  
{
public:
	BlockData(BlockApp *app);
	virtual ~BlockData();
	
	////added methods
	void  initialize();
	void  sendball();
	void  moveboard(boolean PorR, boolean RorL);
	void  moveball(item* ballx);
	void  moveall();
	void  check();
	void  checkball(item* ballx);
	void  catchblock(uint8 type);
	void  hitblock(int8 row, int8 col);
	boolean loseball(item* ballx);
	////void  speedshow();
	void  levelup();
	void  lifeup();
	void  gameover();
	void  username();
	void  newhighscore();
	uint8 randomblock();

	////added fields
	uint16      scrWidth;
	uint16      scrHeight;
	SpriteMgr*  mgr;
	boolean     upgrading;
	boolean     newlevel;
	boolean     newlife;
	boolean     newuser;
	boolean     highscore;
	SpriteModel lettersm[8];
	uint8       letterindex[8];
	uint8       namelen;
	uint8       bottomindex;
	int8        namedir;
	
protected:
	uint16     leftedge;
	uint16     rightedge;
	uint8      level;
	uint32     score;
	uint8      life;	
	uint8      block_array[ARRAY_ROW][ARRAY_COL];
	TileMap    map;
	item       ball1;
	item       ball2;
	item       board;
	item       blocks[ARRAY_ROW][ARRAY_COL];
	uint8      ballcount;
	uint8      ballnumbertime;
	uint8      ballspeedtime;
	uint8      superballtime;
	uint8      boardsizetime;
	uint8      blockcount;
	IGraphics* pg;
	AEERect    rect;
	uint8      upgradetime;
	SpriteModel scoresm[5];	
	SpriteModel lifesm[3];
	SpriteModel edgesm[24];
};

#endif 

⌨️ 快捷键说明

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