scene_loader.c
void MoveTank(SceneData* scene_data, bool left){
	Tank* tank; // Tank ptr
	
	// Choose tank based on turns at the moment
	if(scene_data[CURRENT_SCENE].player_turn == PLAYER_1_TURN){
		printf("Moving tank PLAYER 1\n");
		// Choose active tank from player 1
		int tank_ptr = scene_data[CURRENT_SCENE].Player_1_tank_ptr;
		tank = &(scene_data[CURRENT_SCENE].player_1_tanks_obj[tank_ptr]);
	}else{
		printf("Moving tank PLAYER 2\n");
		// Choose active tank from player 2
		int tank_ptr = scene_data[CURRENT_SCENE].Player_2_tank_ptr;
		tank = &(scene_data[CURRENT_SCENE].player_2_tanks_obj[tank_ptr]);
	}
	
	if(tank->move_limit > 0){
		if(left){
			if(tank->x > 0){
				tank->x--;
				tank->move_limit--;
			}
		}else{
			if(tank->x <= DISPLAY_WIDTH-20){
				tank->x++;
				tank->move_limit--;
			}
		}
		
		printf("New tank.move_limit: %d\n", tank->move_limit);
	}else{
		printf("You dont have enought moves\n");
	}
	return;
}
/*  Move active tank to the left if 'left'==true or right otherwise.  */
Move active tank to the left if 'left'==true or right otherwise.
Move active tank to the left if ' left ' == true or right otherwise .
void MoveTank(SceneData* scene_data, bool left){
	Tank* tank; 
	if(scene_data[CURRENT_SCENE].player_turn == PLAYER_1_TURN){
		printf("Moving tank PLAYER 1\n");
		int tank_ptr = scene_data[CURRENT_SCENE].Player_1_tank_ptr;
		tank = &(scene_data[CURRENT_SCENE].player_1_tanks_obj[tank_ptr]);
	}else{
		printf("Moving tank PLAYER 2\n");
		int tank_ptr = scene_data[CURRENT_SCENE].Player_2_tank_ptr;
		tank = &(scene_data[CURRENT_SCENE].player_2_tanks_obj[tank_ptr]);
	}
	if(tank->move_limit > 0){
		if(left){
			if(tank->x > 0){
				tank->x--;
				tank->move_limit--;
			}
		}else{
			if(tank->x <= DISPLAY_WIDTH-20){
				tank->x++;
				tank->move_limit--;
			}
		}
		printf("New tank.move_limit: %d\n", tank->move_limit);
	}else{
		printf("You dont have enought moves\n");
	}
	return;
}
void MoveTank ( SceneData * scene_data , bool left ) { Tank * tank ; if ( scene_data [ CURRENT_SCENE ] . player_turn == PLAYER_1_TURN ) { printf ( " \n " ) ; int tank_ptr = scene_data [ CURRENT_SCENE ] . Player_1_tank_ptr ; tank = & ( scene_data [ CURRENT_SCENE ] . player_1_tanks_obj [ tank_ptr ] ) ; } else { printf ( " \n " ) ; int tank_ptr = scene_data [ CURRENT_SCENE ] . Player_2_tank_ptr ; tank = & ( scene_data [ CURRENT_SCENE ] . player_2_tanks_obj [ tank_ptr ] ) ; } if ( tank -> move_limit > 0 ) { if ( left ) { if ( tank -> x > 0 ) { tank -> x -- ; tank -> move_limit -- ; } } else { if ( tank -> x <= DISPLAY_WIDTH - 20 ) { tank -> x ++ ; tank -> move_limit -- ; } } printf ( " \n " , tank -> move_limit ) ; } else { printf ( " \n " ) ; } return ; }
Move active tank to the left if 'left'==true or right otherwise.
Move active tank to the left if ' left ' == true or right otherwise .
// Tank ptr // Choose tank based on turns at the moment // Choose active tank from player 1 // Choose active tank from player 2