Esempio n. 1
0
void shoot(void)
{
	init_shot();
	while(!shot_collision())
	{
		//clear last shot graphic
		draw_shot(1);
		
		//calculate effect of gravity and wind
		shot.velo.y += GRAVITY;
		if(shot.velo.y > SHOT_MAX_SPEED)	{ shot.velo.y = SHOT_MAX_SPEED; }
		//TODO wind
		
		//apply velocity
		shot.pos.x += shot.velo.x;
		shot.pos.y += shot.velo.y;
		
		//draw shot
		draw_shot(0);
		
#ifndef TARGET_ESC64
		fflush(stdout);
#endif
		
		//delay
#if SHOT_DELAY > 0
		delayms(SHOT_DELAY);
#endif
	}
}
Esempio n. 2
0
static void draw_shots() {
  for(int i = 0; i<MAX_SHOTS;i++){
    if(game.shots_x[i] < 255){
      draw_shot(i);
    }
  }
}