scene_loader.c
void ProjectileAnimationTick(SceneData* scene_data){

	printf("Projectile animation tick!\n");
	
	// Load projectile
	Projectile* projectile = &(scene_data[SCENE_GAME_MAP].projectile);
	
	// Give the projectile new index pair if there is a valid one left
	int total_pairs = (projectile->parabola)->number_of_pairs;
	int current_index = projectile->projectile_path_pairs_index;
	
	printf("current_index: %d  total_pairs: %d\n", current_index, total_pairs);
	
	if(total_pairs > current_index){
		projectile->projectile_path_pairs_index++;
	}else{
		// End of animation
		printf("Last animation point reached!\n");
		
		// For now close animation
		scene_data[SCENE_GAME_MAP].animating = false;
	}
	
	// Refresh the distances between projectile and players
	RefreshProjectilePlayersDistance(scene_data);
	// Refresh the distance between projectile and the ground
	RefreshProjectileGroundDistance(scene_data);
	// Check if the projectile should explode
	ShouldProjectileExplode(scene_data);
	if(projectile->to_explode){
		printf("Starting the explosion\n");
	}
	
	// Delay the animation a bit
	msleep(PROJECTILE_ANIMATION_DELAY);

	return;
}
/*  This function moves the projectile in animation frame by frame and checks if it
    should explode and end animation.  */
This function moves the projectile in animation frame by frame and checks if it
should explode and end animation.
This function moves the projectile in animation frame by frame and checks if it should explode and end animation .
void ProjectileAnimationTick(SceneData* scene_data){
	printf("Projectile animation tick!\n");
	Projectile* projectile = &(scene_data[SCENE_GAME_MAP].projectile);
	int total_pairs = (projectile->parabola)->number_of_pairs;
	int current_index = projectile->projectile_path_pairs_index;
	printf("current_index: %d  total_pairs: %d\n", current_index, total_pairs);
	if(total_pairs > current_index){
		projectile->projectile_path_pairs_index++;
	}else{
		printf("Last animation point reached!\n");
		scene_data[SCENE_GAME_MAP].animating = false;
	}
	RefreshProjectilePlayersDistance(scene_data);
	RefreshProjectileGroundDistance(scene_data);
	ShouldProjectileExplode(scene_data);
	if(projectile->to_explode){
		printf("Starting the explosion\n");
	}
	msleep(PROJECTILE_ANIMATION_DELAY);
	return;
}
void ProjectileAnimationTick ( SceneData * scene_data ) { printf ( " \n " ) ; Projectile * projectile = & ( scene_data [ SCENE_GAME_MAP ] . projectile ) ; int total_pairs = ( projectile -> parabola ) -> number_of_pairs ; int current_index = projectile -> projectile_path_pairs_index ; printf ( " \n " , current_index , total_pairs ) ; if ( total_pairs > current_index ) { projectile -> projectile_path_pairs_index ++ ; } else { printf ( " \n " ) ; scene_data [ SCENE_GAME_MAP ] . animating = false ; } RefreshProjectilePlayersDistance ( scene_data ) ; RefreshProjectileGroundDistance ( scene_data ) ; ShouldProjectileExplode ( scene_data ) ; if ( projectile -> to_explode ) { printf ( " \n " ) ; } msleep ( PROJECTILE_ANIMATION_DELAY ) ; return ; }
This function moves the projectile in animation frame by frame and checks if it
should explode and end animation.
This function moves the projectile in animation frame by frame and checks if it should explode and end animation .
// Load projectile // Give the projectile new index pair if there is a valid one left // End of animation // For now close animation // Refresh the distances between projectile and players // Refresh the distance between projectile and the ground // Check if the projectile should explode // Delay the animation a bit