Beispiel #1
0
 long MappyLevel::GetTileData(int blockX, int blockY, BLOCK_FIELD field, int layer){
	if(layer < 0 || layer >= layerCount)
		return 0;

	MapChangeLayer(layer);

	BLKSTR * myblock;
	myblock = MapGetBlock(blockX, blockY);
	switch(field){
		case USER1:
			return myblock->user1;
			break;
		case USER2:
			return myblock->user2;
			break;
		case USER3:
			return myblock->user3;
			break;
		case USER4:
			return myblock->user4;
			break;
		case USER5:
			return myblock->user5;
			break;
		case USER6:
			return myblock->user6;
			break;
		case USER7:
			return myblock->user7;
			break;
		case TL:
			return myblock->tl;
			break;
		case TR:
			return myblock->tr;
			break;
		case BL:
			return myblock->bl;
			break;
		case BR:
			return myblock->br;
			break;
		case TRIGGER:
			return myblock->trigger;
			break;
		case UNUSED1:
			return myblock->unused1;
			break;
		case UNUSED2:
			return myblock->unused2;
			break;
		case UNUSED3:
			return myblock->unused3;
			break;
		default:
			return -1;
			break;
	}
	delete myblock;
}
Beispiel #2
0
//collition control
int collided(int x, int y)
{
    BLKSTR *blockdata;
	blockdata = MapGetBlock(x/mapblockwidth, y/mapblockheight);
	return blockdata->tl;
  
}
Beispiel #3
0
int MappyLevel::collided_tl(int x, int y)
{
	if (x < 0 || y < 0 || x >= mapwidth*mapblockwidth || y >= mapheight*mapblockheight) 
		return 0;

	BLKSTR *blockdata;
	blockdata = MapGetBlock(x/mapblockwidth, y/mapblockheight);
	//GraphicsCore::DrawFilledCircle(x - 2, y - 2, 5, 255, 255, 0);
	
	return blockdata->tl;
}
short int Player::checkCollision()
{
	short int user3 = 0;
	int collX = x + .5 * width;
	int collY = y + .5 * height;

	BLKSTR *blockdata = MapGetBlock(collX / mapblockwidth, collY / mapblockheight);
	//If any collision bits are set, assign user3 to the return variable
	if (blockdata->tl || blockdata->tr || blockdata->bl || blockdata->br)
		user3 = blockdata->user3;
	return user3;
} // END checkCollision
short int Player::checkCoordMapCollision()
{
	short int cuser3 = 0;
	int ccollX = coordx * 72.0; // destination coords - get changed when movecounter starts in updatePlayer()
	int ccollY = coordy * 72.0;

	BLKSTR *blockdata = MapGetBlock(ccollX / mapblockwidth, ccollY / mapblockheight);
	//If any collision bits are set, assign user3 to the return variable
	if (blockdata->tl || blockdata->tr || blockdata->bl || blockdata->br)
		cuser3 = blockdata->user3;
	return cuser3;
} // END checkCollision