Skip to main content Link Search Menu Expand Document (external link)

Theme: auto

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:

  1. 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.
  2. Copy your .h/.cpp files from the Lab04 folder to the Lab06 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).
  3. Copy ONLY AudioSystem.h/cpp from the Lab05 folder to the Lab06 folder.
  4. Open your repo in Visual Studio or Visual Studio Code as usual
  5. 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)
  6. Next, remove the following code which you won’t use on this lab:
    1. Remove all the code inside of Game::LoadData
    2. Remove all the level loading code that spawns Blocks/Player/Spawner from the text file (since we’ll do this differently for this lab)
    3. In PlayerMove:
      1. Remove all the code inside of Update and ProcessInput (since Link will move quite differently from Mario)
      2. Remove any member variables you added to PlayerMove related to jumping and y velocity
      3. Remove any code specific to Mario’s animations
    4. In Player, remove all the different animations you loaded/created for Mario
    5. Remove any references to Block/Goomba/Spawner in your game code (including header #includes)
    6. Remove any Mix_PlayChannel calls that are left over from Mario, but DO NOT remove the ones in AudioSystem, as you need the AudioSystem to still work
    7. Remove your sounds map and the GetSound function from Game.h, and then the implementation of GetSound from Game.cpp as well as any references to the sounds map.
    8. Remove any of the game over code from Mario (related to reaching the end of the level or dying)
  7. Make sure your window size is 512x448
  8. In Game::GenerateOutput, make sure your clear draw color is black (eg. 0, 0, 0, 255)
  9. If you don’t have one, you will need to make a public Vector2& GetCameraPos() function in Game that returns the camera position (the reference for the return type of the function is important)
  10. 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.