Skip to content

Commit

Permalink
final version
Browse files Browse the repository at this point in the history
  • Loading branch information
mimocode committed Apr 13, 2019
1 parent 815c881 commit 0e6f01d
Show file tree
Hide file tree
Showing 66 changed files with 538 additions and 337 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified Game.elf
Binary file not shown.
Binary file modified Game.gba
Binary file not shown.
Binary file removed Homework10.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PROGNAME = Game
# line you would put main.o and myLib.o
OFILES = gba.o font.o draw.o logic.o main.o images/garbage.o images/start_screen.o images/ground_block.o images/mario_character.o
OFILES += images/prize_block.o images/prize_block_popped.o images/mario_character_blue.o images/mario_character_b.o images/flag_end.o
OFILES += images/ennemy.o images/game_over.o images/game_win.o
OFILES += images/ennemy.o images/game_over.o images/game_win.o images/fireball.o

################################################################################
# These are various settings used to make the GBA toolchain work
Expand Down
Empty file modified README.md
100644 → 100755
Empty file.
92 changes: 60 additions & 32 deletions draw.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "gba.h"
#include <stdio.h>
#include <stdlib.h>

#include "myLib.h"
#include <math.h>

#include "images/garbage.h"
Expand All @@ -15,6 +15,7 @@
#include "images/mario_character_blue.h"

#include "images/ennemy.h"
#include "images/fireball.h"

#include "images/flag_end.h"
#include "images/game_over.h"
Expand Down Expand Up @@ -70,6 +71,24 @@ void undrawAppState(AppState *state) {
state->scoreJustChanged = 0;
}

if (state->ennemy->justMovedLeft) {
undrawEnnemyMovedLeft(state->ennemy);
state->ennemy->justMovedLeft = 0;
}

if (state->flag->justMovedRight) {
drawRectDMA(18, state->flag->y + 35, 1, 112, BACKGROUND);
state->flag->justMovedRight = 0;
}
if (state->flag->justMovedLeft) {
drawRectDMA(18, state->flag->y - 1, 1, 112, BACKGROUND);
state->flag->justMovedLeft = 0;
}


if (state->mario.isJumpingUp < 7 && state->mario.isJumpingUp >= 1) {
undrawMarioMovedUp(&state->mario);
}

// drawGround(&(state->ground));
// fillScreenDMA(BACKGROUND);
Expand All @@ -92,7 +111,6 @@ void drawAppState(AppState *state) {
}
if (state->brick_block->startX + state->brick_block->width > state->x) {
drawBrickBlock((state->brick_block));

}

// drawImageDMA(18, state->flag->y, 35, 112, flag_end);
Expand All @@ -102,7 +120,7 @@ void drawAppState(AppState *state) {
drawImageDMA(18, state->flag->y, 35, 112, flag_end);
}

if (state->x + 240 >= state->ennemy->startX && state->ennemy->y > -222) {
if (!state->ennemy->dead && (state->ennemy->appeared || (state->x + 240 >= state->ennemy->startX)) && state->ennemy->y > -222) {
drawEnnemy(state->ennemy);
}
// draw the score
Expand All @@ -119,9 +137,16 @@ void drawAppState(AppState *state) {
drawFullScreenImageDMA(game_over);
}
}

if (state->fireball->isOnScreen) {
drawImageDMA(state->fireball->x, state->fireball->y, state->fireball->width, state->fireball->height, fireball);
drawRectDMA(state->fireball->x, state->fireball->y, 1, state->fireball->height, BACKGROUND);
}

}



//This function draws the ground
void drawGround(Ground *ground) {
for (int i = 0; i < 16; i++) {
Expand Down Expand Up @@ -190,6 +215,10 @@ void undrawMarioMovedDown(Mario *mario) {
}


void undrawEnnemyMovedLeft(Ennemy *ennemy) {
drawRectDMA(ennemy->x, 240 + ennemy->y, 1, ennemy->height, BACKGROUND);
}

void drawMarioJump(Mario *mario, Block *block) {
for (int i = 0; i < 7; i++) {
mario->x -= 3;
Expand Down Expand Up @@ -219,34 +248,34 @@ void drawMarioJump(Mario *mario, Block *block) {
}

void drawBlockJump(Block *block) {
for (int i = 0; i < 3; i++) {
block->x -= 3;
if (block->prize) {
drawImageDMA(block->x, block->y + block->startX, block->width, block->height, prize_block);
} else {
drawImageDMA(block->x, block->y + block->startX, block->width, block->height, ground_block);
}

undrawBlockMovedUp(block);
volatile int x = 0;
for (int i = 0; i < 8000; i++) {
x++;
}
}
for (int i = 3; i > 0; i--) {
block->x += 3;
if (block->prize) {
drawImageDMA(block->x, block->y + block->startX, block->width, block->height, prize_block);
} else {
drawImageDMA(block->x, block->y + block->startX, block->width, block->height, ground_block);
}
undrawBlockMovedDown(block);

volatile int x = 0;
for (int i = 0; i < 8000; i++) {
x++;
}
}
// for (int i = 0; i < 3; i++) {
// block->x -= 3;
// if (block->prize) {
// drawImageDMA(block->x, block->y + block->startX, block->width, block->height, prize_block);
// } else {
// drawImageDMA(block->x, block->y + block->startX, block->width, block->height, ground_block);
// }

// undrawBlockMovedUp(block);
// // volatile int x = 0;
// // for (int i = 0; i < 8000; i++) {
// // x++;
// // }
// }
// for (int i = 3; i > 0; i--) {
// block->x += 3;
// if (block->prize) {
// drawImageDMA(block->x, block->y + block->startX, block->width, block->height, prize_block);
// } else {
// drawImageDMA(block->x, block->y + block->startX, block->width, block->height, ground_block);
// }
// undrawBlockMovedDown(block);

// // volatile int x = 0;
// // for (int i = 0; i < 8000; i++) {
// // x++;
// // }
// }
drawImageDMA(block->x, block->y + block->startX, block->width, block->height, prize_block_popped);
block->isPopped = 1;
//drawImageDMA(mario->x, mario->y, mario->width, mario->height, mario_character);
Expand Down Expand Up @@ -280,7 +309,6 @@ void drawBrickBlock(Block *block) {
}

void drawEnnemy(Ennemy *ennemy_mario) {

drawImageDMA(ennemy_mario->x, ennemy_mario->y + 222, ennemy_mario->width, ennemy_mario->height, mario_ennemy);
}

Expand Down
22 changes: 1 addition & 21 deletions draw.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,5 @@ void drawAppState(AppState *state);

// If you have anything else you need accessible from outside the graphics.c
// file, you can add them here. You likely won't.
void drawMario(Mario *mario);
void drawMarioMovedRight(Mario *mario);
void undrawMarioMovedRight(Mario *mario);
void drawMarioMovedLeft(Mario *mario);
void undrawMarioMovedLeft(Mario *mario);
void drawMarioJump(Mario *mario, Block *block);
void undrawMarioMovedUp(Mario *mario);
void undrawMarioMovedDown(Mario *mario);
void drawBlock(Block *block);
void drawGround(Ground *ground);
void drawGroundMarioMovedRight(Ground *ground);
void drawBlockMarioMovedRight(Block *block);
void undrawBlockMarioMovedRight(Block *block);
void drawBlockMarioMovedLeft(Block *block);
void drawGroundMarioMovedLeft(Ground *ground);
void undrawBlockMarioMovedLeft(Block *block);
void drawBlockJump(Block *block);
void undrawBlockMovedUp(Block *block);
void undrawBlockMovedDown(Block *block);
void drawBrickBlock(Block *block);
void drawEnnemy(Ennemy *ennemy);

#endif
Binary file modified draw.o
Binary file not shown.
6 changes: 3 additions & 3 deletions emulator.log
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Starting Mednafen 0.9.48
Loading override settings from "/cs2110/.mednafen/pgconfig/Game.gba.cfg"...
Failed: Error opening file "/cs2110/.mednafen/pgconfig/Game.gba.cfg": No such file or directory

ROM: 298KiB
ROM CRC32: 0x8f01dc08
ROM MD5: 0x1885dd1acc4bdfbbef5aea044623816c
ROM: 299KiB
ROM CRC32: 0xd3d4cdc9
ROM MD5: 0xe01aaec82ebf14c81dcf1342eace7bfa

Loading custom palette from "/cs2110/.mednafen/palettes/gba.pal"...
Error: Error opening file "/cs2110/.mednafen/palettes/gba.pal": No such file or directory
Expand Down
Empty file modified font.c
100644 → 100755
Empty file.
Empty file modified gba.c
100644 → 100755
Empty file.
Empty file modified gba.h
100644 → 100755
Empty file.
Binary file modified images/.DS_Store
100644 → 100755
Binary file not shown.
Empty file modified images/OvertheFlagpole.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/ennemy.c
100644 → 100755
Empty file.
Empty file modified images/ennemy.h
100644 → 100755
Empty file.
22 changes: 22 additions & 0 deletions images/fireball.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Exported with nin10kit v1.7
* Invocation command was nin10kit --mode=3 --resize=8x8 fireball fireball.jpg
* Time-stamp: Thursday 04/11/2019, 02:37:23
*
* Image Information
* -----------------
* fireball.jpg 8@8
*
* All bug reports / feature requests are to be filed here https://github.com/TricksterGuy/nin10kit/issues
*/

#include "fireball.h"

const unsigned short fireball[64] =
{
0x7569,0x7d48,0x61ef,0x2e9a,0x227c,0x4676,0x758a,0x7948,0x7d48,0x5632,0x0e7f,0x057f,0x093f,0x05bf,0x2e9b,0x758a,
0x71ac,0x1a9f,0x051f,0x0dbf,0x0dff,0x0d3f,0x05bf,0x4a55,0x5254,0x09ff,0x0d7f,0x0e1f,0x0ddf,0x0ddf,0x055f,0x367a,
0x4298,0x057f,0x08ff,0x0d9f,0x0dff,0x0d5f,0x057f,0x4277,0x4a76,0x0a5f,0x121f,0x05bf,0x051f,0x013f,0x1a9f,0x6dcd,
0x6dad,0x2add,0x5a52,0x3a78,0x267c,0x329a,0x69ce,0x7948,0x7d48,0x65cf,0x698c,0x7d27,0x798a,0x7d69,0x7948,0x7569
};

23 changes: 23 additions & 0 deletions images/fireball.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Exported with nin10kit v1.7
* Invocation command was nin10kit --mode=3 --resize=8x8 fireball fireball.jpg
* Time-stamp: Thursday 04/11/2019, 02:37:23
*
* Image Information
* -----------------
* fireball.jpg 8@8
*
* All bug reports / feature requests are to be filed here https://github.com/TricksterGuy/nin10kit/issues
*/

#ifndef FIREBALL_H
#define FIREBALL_H

extern const unsigned short fireball[64];
#define FIREBALL_SIZE 128
#define FIREBALL_LENGTH 64
#define FIREBALL_WIDTH 8
#define FIREBALL_HEIGHT 8

#endif

Binary file added images/fireball.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/fireball.o
Binary file not shown.
Loading

0 comments on commit 0e6f01d

Please sign in to comment.