Ejemplo n.º 1
0
bool Entity::CheckEntityColl(Entity object)
{
    float Bx = object.XPos;
    float By = object.YPos;
    float Bw = object.Width;
    float Bh = object.Height;

    /*if ( YPos + Height < By ) return false;
    else if ( YPos > By + Bh ) return false;
    else if ( XPos + Width < Bx ) return false;
    else if ( XPos > Bx + Bw ) return false;*/

    if(!CheckColl(Bx, By, Bw, Bh)) return false;

    return true;
}
Ejemplo n.º 2
0
void MakeRoom(struct Room rs[100], int *lenrs,uint32_t *gen){
	int x = GenRand(gen) % TileDim;
	int y = GenRand(gen) % TileDim;
	int w = GenRand(gen) % RestWidMax+WidMin;
	int h = GenRand(gen) % RestWidMax+WidMin;

	if(x+w>=TileDim || y+h>=TileDim || x==0 || y==0) return;
	int nocrash = CheckColl(x,y,w,h,rs,*lenrs);
	if (nocrash==0){
		struct Room r;
		r.X = x;
		r.Y = y;
		r.W = w;
		r.H = h;
		r.N = *lenrs;
		rs[*lenrs]=r;
		*lenrs = *lenrs+1;
	}
}