Example #1
0
int main(void) {
	REG_DISPCNT = MODE3 | BG2_ENABLE;
	
	while(1){
		if(start == -1) 
		{
			waitForVblank();
			bricksSet(Bricks);
			cleanScreen();
			startscreen();
			waitForVblank();
			start = 1;
			cleanScreen();
			bricksDraw();
			barSet();
			ballSet();
		}
		CollisionDetect_BRICKS();
		barControl();
		ballControl();
		waitForVblank();
		if(KEY_DOWN_NOW(BUTTON_SELECT))
		{
			Reset();
			continue;
		}
		if(score == 600 || life == 0){
			cleanScreen();
			overscreen();
			Reset();	
		}
	}
}	
Example #2
0
void barControl(){
		ballControl();
        	if(KEY_DOWN_NOW(BUTTON_RIGHT))
        	{
			cur_bar->CL = cur_bar->CL + cur_bar->CD;
        	}
        	if(KEY_DOWN_NOW(BUTTON_LEFT))
        	{
             		cur_bar->CL = cur_bar->CL - (cur_bar->CD);
		}       
            	cur_bar = &bar;
           	oldcur_bar = &bar_old;
            
            	if(cur_bar->CL < 0)
            	{
                	cur_bar->CL = 0;
            	}
            	if(cur_bar->CL > 239-BAR_Width+1)
            	{
                	cur_bar->CL = 239-BAR_Width+1;
            	}
	    waitForVblank();
            oldcur_bar = &bar_old;
	    drawImage3(oldcur_bar->RW, oldcur_bar->CL, BAR_Width, BAR_Height, 0x0000);           
            bar_old = bar;      
            cur_bar = &bar;
            drawImage3(cur_bar->RW, cur_bar->CL, BAR_Width, BAR_Height, BAR); 
}
task main()
{
    initializeRobot();

    waitForStart();   // wait for start of tele - op phase

    while (true) {
        getJoystickSettings(joystick);
        movementControl();
        ballControl();
        lifterControl();
        GripperControl();
        basketControl();
    }
}