Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ first one second one if and else statement in c++ one for obstcalwcollison the other to flag if and else statmemge with those requirements

c++ image text in transcribed
image text in transcribed
first one image text in transcribed
second one
image text in transcribed
image text in transcribed
if and else statement in c++ one for obstcalwcollison the other to flag
image text in transcribed
if and else statmemge with those requirements image text in transcribed
bool game::obstacleColl(Obstacle &obs, Car &car) Ouse of undeclared identifier 'game' 1/ Complete the function using the selection structure if/else // to detect a collision between the obstacle and the car. // Recall from the instructions that the car does not move in the 1/ X axis and that the fix X asix is stored in CARX. 1/ OBSTACLERANGE contains the range from the obstacle center to 1/ each side. I } void game:: FlagCol Flag &flag, Car &car){ Ouse of undeclared tdentifier 'game' H Complete the function using the selection structure if/else 1/ to detect a collision between the flag and the car. 1 Recall from the instructions that the car does not move in the H X axis and that the fix X asix is stored in CARX. 1/ FLAGRANGE contains the range from the flag center to 7/ each side. // If there is a collision set the score to 30 more points 1/ and hide the flag. 1 string Car::getCar() { return name; } 7/1 Setter for the Y coordinate of the racecar void Car::setYCar(int arg) { y_car = argi } III Getter for the Y coordinate of the racecar int Car::getYCar() { return y_car; } The function receives an object of the obstacle class and another object of the Car class, and should detect if there is a collision or not between the car and the obstacle. The function returns true if there is a collision between the car and an obstacle, and false if there is no collision To detect the collision, the function should ask for the coordinates of the obstacle and the car's coordinate. Remember that the car does not move on the axis, since that coordinate is fixed and stored in a constant variable called CARX The collision occurs if the obstacle has the same coordinate, and is a certain distance above and below the car's coordinate as shown in Figure 1. The range of the distance of the obstacle's center upwards and downwards is stored in the variable called OBSTACLERANGE If a collision is detected, the function returns true and if not the function should return false The function receives an object of the Obstacle class and another object of the Car class, and should detect if there is a collision or not between the car and the obstacle. The function returns true if there is a collision between the car and an obstacle, and false if there is no collision. To detect the collision, the function should ask for the coordinates of the obstacle and the car's coordinate. Remember that the car does not move on the axis, since that coordinate is fixed and stored in a constant variable called CARX The collision occurs if the obstacle has the same coordinate, and is a certain distance above and below the car's coordinate as shown in Figure 1. The range of the distance of the obstacle's center upwards and downwards is stored in the variable called OBSTACLE RANGE If a collision is detected, the function returns true and if not the function should return false /// /// Getter for the obstacle picture 771 string Obstacle::getObs() { return name: } /// Setter for the X coordinate /// void Obstacle::setObstacle(int arg) *_obstacle - arg; 3 /// Setter for the Y coordinate /// void Obstaclei setYobstacle(int arg) { y obstacle - argi 3 /// Getter for the X coordinate 1/7 int Obstacle::getxobstacle() return x_obstacle; 3 /// Getter for the Y coordinate Ant Obstacle::getYObstacle() return y obstacle; > obtstacle.h y obstacle.cpp: contains the definition of the class Obstacle, the methods of the class and their declarations. o play.h y play.cpp contains the definition of the class Play, the methods of the class and their declarations. Familiarize yourself with the methods in these files. Emphasize the following methods: Car::getyCar() : Returns the {% math %}Y{% endmath %) coordinate of the car's position on the track o Flag::getXFlag() : Returns the % math %}X{% endmath %) coordinate of the flag's position on the track Flag::getyFlag : Returns the % math %}Y{% endmath %) coordinate of the flag's position on the track Flag::hide(): Hides the flag. o Obstacle::getxobstacle(): Returns the {% math %}X{% endmath %) coordinate of the obstacle's position on the track. o Obstacle::getYobstacle(): Returns the {% math %)Y[% endmath %} coordinate of the obstacle's position on the track. o Play::setScore(n) : Receives an integer number and adds it to the game's total score. There isn't a getxCar() method because the car does not move on the {% math %}X{% endmath %) axis. bool game::obstacleColl(Obstacle &obs, Car &car) Ouse of undeclared identifier 'game' Il Complete the function using the selection structure iffelse // to detect a collision between the obstacle and the car. 1/ Recall from the instructions that the car does not move in the 1/ X axis and that the fix X asix is stored in CARX. // OBSTACLERANGE contains the range from the obstacle center to 1/ each side. I } void game:: flagColFlag &flag, Car (car) { Ouse of undeclared identifier 'game' H Complete the function using the selection structure if/else 1/ to detect a collision between the flag and the car. 1 Recall from the instructions that the car does not move in the H7 X axis and that the fix X asix is stored in CARX. /FLAGRANGE contains the range from the flag center to 7/ each side. // If there is a collision set the score to 30 more points 1/ and hide the flag. bool game::obstacleColl(Obstacle &obs, Car &car) Ouse of undeclared identifier 'game' 1/ Complete the function using the selection structure if/else // to detect a collision between the obstacle and the car. // Recall from the instructions that the car does not move in the 1/ X axis and that the fix X asix is stored in CARX. 1/ OBSTACLERANGE contains the range from the obstacle center to 1/ each side. I } void game:: FlagCol Flag &flag, Car &car){ Ouse of undeclared tdentifier 'game' H Complete the function using the selection structure if/else 1/ to detect a collision between the flag and the car. 1 Recall from the instructions that the car does not move in the H X axis and that the fix X asix is stored in CARX. 1/ FLAGRANGE contains the range from the flag center to 7/ each side. // If there is a collision set the score to 30 more points 1/ and hide the flag. 1 string Car::getCar() { return name; } 7/1 Setter for the Y coordinate of the racecar void Car::setYCar(int arg) { y_car = argi } III Getter for the Y coordinate of the racecar int Car::getYCar() { return y_car; } The function receives an object of the obstacle class and another object of the Car class, and should detect if there is a collision or not between the car and the obstacle. The function returns true if there is a collision between the car and an obstacle, and false if there is no collision To detect the collision, the function should ask for the coordinates of the obstacle and the car's coordinate. Remember that the car does not move on the axis, since that coordinate is fixed and stored in a constant variable called CARX The collision occurs if the obstacle has the same coordinate, and is a certain distance above and below the car's coordinate as shown in Figure 1. The range of the distance of the obstacle's center upwards and downwards is stored in the variable called OBSTACLERANGE If a collision is detected, the function returns true and if not the function should return false The function receives an object of the Obstacle class and another object of the Car class, and should detect if there is a collision or not between the car and the obstacle. The function returns true if there is a collision between the car and an obstacle, and false if there is no collision. To detect the collision, the function should ask for the coordinates of the obstacle and the car's coordinate. Remember that the car does not move on the axis, since that coordinate is fixed and stored in a constant variable called CARX The collision occurs if the obstacle has the same coordinate, and is a certain distance above and below the car's coordinate as shown in Figure 1. The range of the distance of the obstacle's center upwards and downwards is stored in the variable called OBSTACLE RANGE If a collision is detected, the function returns true and if not the function should return false /// /// Getter for the obstacle picture 771 string Obstacle::getObs() { return name: } /// Setter for the X coordinate /// void Obstacle::setObstacle(int arg) *_obstacle - arg; 3 /// Setter for the Y coordinate /// void Obstaclei setYobstacle(int arg) { y obstacle - argi 3 /// Getter for the X coordinate 1/7 int Obstacle::getxobstacle() return x_obstacle; 3 /// Getter for the Y coordinate Ant Obstacle::getYObstacle() return y obstacle; > obtstacle.h y obstacle.cpp: contains the definition of the class Obstacle, the methods of the class and their declarations. o play.h y play.cpp contains the definition of the class Play, the methods of the class and their declarations. Familiarize yourself with the methods in these files. Emphasize the following methods: Car::getyCar() : Returns the {% math %}Y{% endmath %) coordinate of the car's position on the track o Flag::getXFlag() : Returns the % math %}X{% endmath %) coordinate of the flag's position on the track Flag::getyFlag : Returns the % math %}Y{% endmath %) coordinate of the flag's position on the track Flag::hide(): Hides the flag. o Obstacle::getxobstacle(): Returns the {% math %}X{% endmath %) coordinate of the obstacle's position on the track. o Obstacle::getYobstacle(): Returns the {% math %)Y[% endmath %} coordinate of the obstacle's position on the track. o Play::setScore(n) : Receives an integer number and adds it to the game's total score. There isn't a getxCar() method because the car does not move on the {% math %}X{% endmath %) axis. bool game::obstacleColl(Obstacle &obs, Car &car) Ouse of undeclared identifier 'game' Il Complete the function using the selection structure iffelse // to detect a collision between the obstacle and the car. 1/ Recall from the instructions that the car does not move in the 1/ X axis and that the fix X asix is stored in CARX. // OBSTACLERANGE contains the range from the obstacle center to 1/ each side. I } void game:: flagColFlag &flag, Car (car) { Ouse of undeclared identifier 'game' H Complete the function using the selection structure if/else 1/ to detect a collision between the flag and the car. 1 Recall from the instructions that the car does not move in the H7 X axis and that the fix X asix is stored in CARX. /FLAGRANGE contains the range from the flag center to 7/ each side. // If there is a collision set the score to 30 more points 1/ and hide the flag

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data In Just 7 Chapters

Authors: Prof Marcus Vinicius Pinto

1st Edition

B09NZ7ZX72, 979-8787954036

More Books

Students also viewed these Databases questions

Question

Prepare for a successful job interview.

Answered: 1 week ago

Question

Describe barriers to effective listening.

Answered: 1 week ago

Question

List the guidelines for effective listening.

Answered: 1 week ago