我正在尝试ball通过调用函数来更改s 位置
struct ball
{
int heading = north_east;
bool visible = true;
int pos_x = ball_start_x;
int pos_y = ball_start_y;
char c = 'o';
};
void move_ball(ball *target_ball)
{
switch (target_ball->heading)
{
case north_east:
{
target_ball->pos_x ++ ;
target_ball->pos_y -- ;
}
case north_west:
{
target_ball->pos_x -- ;
target_ball->pos_y -- ;
}
case south_west:
{
target_ball->pos_x ++ ;
target_ball->pos_y ++ ;
}
case south_east:
{
target_ball->pos_x -- ;
target_ball->pos_y ++ ;
}
}
}
int main(){
ball …Run Code Online (Sandbox Code Playgroud)