Setup
This lab builds on some of the code in Lab 4 and Lab 5. You need to have at least completed the AnimatedSprite
implementation to continue onto Lab 6, and the AudioSystem
in Lab 5.
Do the following to prepare your Lab06
project:
- IMPORTANT - Because this lab mostly builds on Lab 4’s code, and not Lab 5, you must copy files from Lab 4! If you copy files from Lab 5 you will get stuck.
- Copy your .h/.cpp files from the
Lab04
folder to theLab06
folder EXCEPT do not copy Block.h/cpp, Goomba.h/cpp, GoombaMove.h/cpp, or Spawner.h/cpp, as you do not need these for Lab 6. (Make sure you copy using Finder or Explorer to copy files, don’t try to drag-and-drop from Visual Studio or Xcode). - Copy ONLY AudioSystem.h/cpp from the
Lab05
folder to theLab06
folder. - Open your repo in Visual Studio or Visual Studio Code as usual
- Now you need to change the build target from “Lab05” to “Lab06.” In Visual Studio (PC) this is via the dropdown near the play button. For Visual Studio Code (Mac), you should change both instances of “Lab05” on the bottom toolbar (one for the build target and the other for the run target)
- Next, remove the following code which you won’t use on this lab:
- Remove all the code inside of
Game::LoadData
- Remove all the level loading code that spawns
Blocks
/Player
/Spawner
from the text file (since we’ll do this differently for this lab) - In
PlayerMove
:- Remove all the code inside of
Update
andProcessInput
(since Link will move quite differently from Mario) - Remove any member variables you added to
PlayerMove
related to jumping and y velocity - Remove any code specific to Mario’s animations
- Remove all the code inside of
- In
Player
, remove all the different animations you loaded/created for Mario - Remove any references to
Block
/Goomba
/Spawner
in your game code (including header#include
s) - Remove any
Mix_PlayChannel
calls that are left over from Mario, but DO NOT remove the ones inAudioSystem
, as you need theAudioSystem
to still work - Remove your sounds map and the
GetSound
function from Game.h, and then the implementation ofGetSound
from Game.cpp as well as any references to the sounds map. - Remove any of the game over code from Mario (related to reaching the end of the level or dying)
- Remove all the code inside of
- Make sure your window size is
512
x448
- In
Game::GenerateOutput
, make sure your clear draw color is black (eg.0, 0, 0, 255
) - If you don’t have one, you will need to make a public
Vector2& GetCameraPos()
function inGame
that returns the camera position (the reference for the return type of the function is important) - Your code should now compile and run, and you will see a window cleared to black. You won’t see any other objects as you aren’t spawning any yet. If it doesn’t compile, review the compile error messages to figure out what you still need to remove.
Now you’re ready for part 1 of the lab.