Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / 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

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

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

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE