Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Game Engine Foundations Lab Seven So far, we have created a 3D-World and we can traverse in it using keyboard and mouse ? Starting this lab and continuing in future labs, we want to add shooting functionality and be able to detect collision among objects

Computer Science Apr 04, 2022

Game Engine Foundations

Lab Seven

So far, we have created a 3D-World and we can traverse in it using keyboard and mouse ?

Starting this lab and continuing in future labs, we want to add shooting functionality and be able to detect collision among objects. We’ll eventually get there in class and in labs.

In this lab, however, you will be introduced to spawning objects in game scene. To complete your lab, you will need to complete the following tasks:

1 – Create a class and name it “GameObject”.  For now, required attributes of this class are:

  • Type (char): Identifies the type of this game object, e.g. enemy, bullet, player, weapon, etc.
  • Location (3D-Vector): The location of this object on the game scene

 

2 – Create a collection (vector) of class “GameObject” and name this collection “gameScene” and make it a global variable in your program.

3 – Develop a function and name it “drawObjects()”. The task of this function is to iterate through the elements in the collection “gameScene’ and draw these elements on the screen in their appropriate position. For this lab, simply use a small box for the shape of this object.

4 – Now, when the player press ‘o’, add an instance of “GameObject” to “gameScene” Collection. Set its location to be the current location of the player.

If you have done this successfully, you will see a textured box spawned on the player’s position once ‘o’ is pressed. In future labs, I’ll show you how to move this object in a specific direction.

To submit:

ONLY submit the .cpp file that you develop. Please do NOT zip your file

Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment