
scene clip(1,8000);
scene position(-467,10,-450);
scene rotation(1,47,0);

FLOOR = load("FLOOR");
object FLOOR position(0,-140,0);
object FLOOR active(1);

WALL = load("FLOOR");
object WALL position(390,250,0);
object WALL rotation(90,0,-90);
object WALL active(1);

WALL = load("FLOOR");
object WALL position(0,250,390);
object WALL rotation(90,0,0);
object WALL active(1);

CUBE = load("cube");
object CUBE position(0,-90,0);
object CUBE active(1);

scene keybd(1);
scene start;

// we want to simply detect the "spacebar" and rotate the small cube
// more: we color in yellow the current object in front of the camera
angle_y   = 0;
oldObject = -1;	
while(1)
{
	isClicked = status keystate(32);	//check the #32 button status (the spacebar)

    //if the spacebar is pressed....
	if (isClicked)
	{
		object CUBE rotation  (0,(angle_y+=2),0); //rotate the cube
		
		/****************************************/
		currObject = status selection(0);					//detect the current object

        if (oldObject > -1 && currObject > -1)	//restore any previous "yellow object"
			object oldObject diffuse(1,1,1);

        if (currObject > -1)
        {								//if exists change the color to yellow
			object currObject diffuse(1,1,0);
            oldObject = currObject;                             //store the "yellow" object (to restore to white)
		}
        /****************************************/
	}
		
	sleep(100);
} 










