CS 2261 LAB 09: Complex Movement & Collision Maps

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (3 votes)

Provided Files
● Example.gba
● main.c
● myLib.c
● myLib.h
● game.c
● game.h
● background.bmp
● background.c
● background.h
● spritesheet.bmp
● spritesheet.c
● spritesheet.h
● collisionmap.bmp
Files to Edit/Add
● game.c
● collisionmap.c
● collisionmap.h
● Makefile
● .vscode
○ tasks.json
Instructions
In this lab, you will be completing several different TODOs, which will, piece by piece, add
complex sprite movement. Your code may not compile until you complete an entire TODO
block, at which point the game should compile with a new component of the final outcome
(unless otherwise specified).
TODO 1 – Complex Camera Movement
We want our jigglypuff to walk only on the screen, and have the camera follow it without
showing something outside of the world.
● TODO 1.0
CS 2261 Spring 2021
○ In game.c, in the updatePlayer() function, add in the sprite and camera
movement.
● TODO 1.1
○ In game.c in the drawPlayer() function, set jigglypuff’s screen row and column
in the shadowOAM
■ Hint: the screen row is the world row minus the background vertical
offset; the screen col is the world col minus the background horizontal
offset
Your jigglypuff should now be able to walk around and see the entire map, but not off of the
edge. The jigglypuff should always be in the middle of the screen unless at the edge of the
map (see the example.gba).
TODO 2.0 – Collision Map
Now we want our jigglypuff to treat the visuals of the map as if they were actual barriers to
movement.
● TODO 2.0
○ The collision map has been created for you. Open collisionmap.bmp in Usenti
and export it. Remember that we want to check the colors of each pixel, so
take that into account when choosing export settings. As such, export the
collision map as bitmap(GBA) and select 16 bpp. Uncheck the Pal box.
● TODO 2.1
○ Include collisionmap.h in game.c.
● TODO 2.2
○ Update your movement code to only allow jigglypuff to move if the collision
map allows it (is white) in the areas that you need to check. Your jigglypuff
should not be able to walk over the fences, trees, bushes, and flowers.
You will know if it runs correctly if you:
● Your Project.gba has the same behavior as the Example.gba provided for you. The
Example.gba jigglypuff is purple, but Project.gba jigglypuff should be pink.
Tips
● Review recitation materials: Canvas > Recitation Materials
○ Complex movement
○ Collision maps
CS 2261 Spring 2021
Submission Instructions
Zip up your entire project folder, including all source files, the Makefile, and everything
produced during compilation (including the .gba file). Submit this zip on Canvas. Name
your submission Lab09_FirstameLastname, for example: “Lab09_TeamRocket.zip”.