Starting from:

$25

CS2261- Lab 08 Solved

Provided Files
●     main.c

●     myLib.c

●     myLib.h

●     bg.bmp

●     spritesheet.bmp

 

Files to Edit/Add
●     main.c

●     myLib.c

●     bg.c

●     bg.h

●     spritesheet.c

●     spritesheet.h

●     Your Makefile

 

Instructions
In this lab, you will be completing several different TODOs, which will, piece by piece, complete an animated pikachu character that the player can control. 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 – Exporting the tiles

We need to export the backgrounds and tiles in order to use them in the code.

●     TODO1.0: Open bg.bmp in Usenti.

●     TODO 1.1: Go to Image Export, keep the default name, and make sure the type is GBA Source. Make sure it is exporting them to your Lab08 folder.

●     TODO 1.2: In the Export popup, make sure the type is 4bpp tiles, and make sure that Pal is checked and Map is checked, because this is a background.

●     TODO1.3: Open sprite sheet.bmp in Usenti.

●     TODO 1.4: Go to Image Export, keep the default name, and make sure the type is GBA Source. Make sure it is exporting them to your Lab08 folder.

●     TODO 1.5: In the Export popup, make sure the type is 4bpp tiles, and make sure that Pal is checked and Map is ​not ​checked, because this is a spritesheet.

●     TODO 1.6: Add the new .c files to your Makefile.

At this point, we haven’t added them to your code, so compiling will not do anything useful.

 

TODO 2 – Displaying the Background

We want to be able to actually see the background, so let’s set that up.

From now on, the TODO’s will have their description in the code. Their location in the file will be listed here.

●     TODO2.0: Top of main.c.

●     TODO2.1: main.c, initialize() function.

●     TODO2.2: main.c, initialize() function, under REG_DISPCTL. Compile and run. You should see the background on the screen. If not, then you either exported wrong or did not load the tiles or map into memory correctly. Fix this before continuing.

 

 ​TODO 3 – Loading and Enabling Sprites  Let’s get sprites working.

●     TODO3.0: main.c, initialize() function.

●     TODO3.1: myLib.c, hideSprites() function.

●     TODO3.2: main.c, initialize() function

Compile and run. You should not see anything new. If you see anything in the top-left (CORNERFACE), fix this before going further.

 

 ​TODO 4 – Animating Sprites

 Let’s show pikachu, and get animations working.

●     TODO4.0: main.c, bottom of initialize() function.

●     TODO4.1-4.9: main.c, in the main while loop.

Compile and run. You should be able to walk pikachu around infinitely, see your background repeat, and all the while pikachu stays in the middle of the screen. If this all works, 

More products