예제 #1
0
bool GeradMoveLeft(float &x, float &y)
{
	 x -= Gerad.GetSpeed();
			if(Timer->elapsed(walkTimer, STOPTIME))
			{
			    Gerad.Setxy(x, y);
				walkTimer = Timer->time();
			}
			for(int i = 0;i < currentLocation->ObjectNum;i++)
			{
				if(currentLocation->objects[i].IsWithin(x, y))
				{
					x += Gerad.GetSpeed();
					Gerad.SetStopStatus();
					Gerad.Setxy(x, y);
					return true;
				}
			}
			if(x <= 0)
			if(currentLocation->left != NULL)
			{
				    currentLocation = currentLocation->left;
				    x = 462;
				    background.load(currentLocation->getName());
				    background.loadGLTextures();
			}
			else {x = 0; Gerad.SetStopStatus();}
		    if(Timer->elapsed(walkTimer, STOPTIME))
			{
			    Gerad.Setxy(x, y);
				walkTimer = Timer->time();
			}
			return true;
}
예제 #2
0
bool GeradMoveBack(float &x, float &y)
{
	y -= Gerad.GetSpeed();
			if(Timer->elapsed(walkTimer, STOPTIME))
			{
			    Gerad.Setxy(x, y);
				walkTimer = Timer->time();
			}
			for(int i = 0;i < currentLocation->ObjectNum;i++)
			{
				if(currentLocation->objects[i].IsWithin(x, y))
				{
					y += Gerad.GetSpeed();
					Gerad.SetStopStatus();
					Gerad.Setxy(x, y);
					return true;
				}
			}
			if(y <= 0)
			{
				if(currentLocation->top != NULL)
				{
				    currentLocation = currentLocation->top;
					if(topInterior)InInterior = true;
				    y = 462;
				    background.load(currentLocation->getName());
				    background.loadGLTextures();
				}
				else
				{
					y = 0;
					Gerad.SetStopStatus();
				}
			}
		    if(Timer->elapsed(walkTimer, STOPTIME))
			{
			    Gerad.Setxy(x, y);
				walkTimer = Timer->time();
			}
			return true;
}