Skip to content

Commit

Permalink
Added sound effects
Browse files Browse the repository at this point in the history
Merge pull request #5 from haroldo-ok/sound
  • Loading branch information
haroldo-ok authored Dec 11, 2021
2 parents 79e2785 + 523f2ac commit 80d7bde
Show file tree
Hide file tree
Showing 20 changed files with 14 additions and 7 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ OBJS := data.rel actor.rel chicken_crossing.rel

all: $(PRJNAME).sms

data.c: data/* data/sprites_tiles.psgcompr data/background_tiles.psgcompr
data.c: data/* data/sprites_tiles.psgcompr data/background_tiles.psgcompr \
data/player_1_score.psg data/player_2_score.psg data/player_3_score.psg data/player_4_score.psg
folder2c data data

data/sprites_tiles.psgcompr: data/img/sprites.png
Expand All @@ -12,6 +13,9 @@ data/sprites_tiles.psgcompr: data/img/sprites.png
data/background_tiles.psgcompr: data/img/background.png
BMP2Tile.exe data/img/background.png -palsms -fullpalette -savetiles data/background_tiles.psgcompr -savetilemap data/background_tilemap.bin -savepalette data/background_palette.bin

data/%.psg: data/deflemask/%.vgm
vgm2psg $< $@ 23

data/%.path: data/path/%.spline.json
node tool/convert_splines.js $< $@

Expand Down
15 changes: 9 additions & 6 deletions chicken_crossing.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ void player_knockback(actor *ply) {
ply->state_timer--;
}

void check_player_reached_top(actor *ply, score_data *score) {
void check_player_reached_top(actor *ply, score_data *score, void *sfx) {
if (ply->y > PLAYER_TOP + PLAYER_SPEED) return;

ply->y = PLAYER_BOTTOM;
add_score(score, 1);
PSGSFXPlay(sfx, SFX_CHANNELS2AND3);
}

void handle_player_input() {
Expand All @@ -147,7 +148,7 @@ void handle_player_input() {
}
}
player_knockback(player1);
check_player_reached_top(player1, score1);
check_player_reached_top(player1, score1, player_1_score_psg);

// Player 2
if (!player2->state) {
Expand All @@ -162,7 +163,7 @@ void handle_player_input() {
}
}
player_knockback(player2);
check_player_reached_top(player2, score2);
check_player_reached_top(player2, score2, player_2_score_psg);

// Player 3
if (!player3->state) {
Expand All @@ -177,7 +178,7 @@ void handle_player_input() {
}
}
player_knockback(player3);
check_player_reached_top(player3, score3);
check_player_reached_top(player3, score3, player_3_score_psg);

// Player 4
if (!player4->state) {
Expand All @@ -192,7 +193,7 @@ void handle_player_input() {
}
}
player_knockback(player4);
check_player_reached_top(player4, score4);
check_player_reached_top(player4, score4, player_4_score_psg);
}

void adjust_facing(actor *act, char facing_left) {
Expand Down Expand Up @@ -496,6 +497,8 @@ char gameplay_loop() {
level.starting = 1;
}

PSGPlayNoRepeat(player_shot_psg);

handle_player_input();

handle_spawners();
Expand Down Expand Up @@ -595,6 +598,6 @@ void main() {
}

SMS_EMBED_SEGA_ROM_HEADER(9999,0); // code 9999 hopefully free, here this means 'homebrew'
SMS_EMBED_SDSC_HEADER(0,2, 2021,12,10, "Haroldo-OK\\2021", "Chicken Crossing",
SMS_EMBED_SDSC_HEADER(0,3, 2021,12,11, "Haroldo-OK\\2021", "Chicken Crossing",
"Made for The Honest Jam III - https://itch.io/jam/honest-jam-3.\n"
"Built using devkitSMS & SMSlib - https://github.com/sverx/devkitSMS");
Binary file added data/deflemask/player_1_score.dmf
Binary file not shown.
Binary file added data/deflemask/player_1_score.vgm
Binary file not shown.
Binary file added data/deflemask/player_2_score.dmf
Binary file not shown.
Binary file added data/deflemask/player_2_score.vgm
Binary file not shown.
Binary file added data/deflemask/player_3_score.dmf
Binary file not shown.
Binary file added data/deflemask/player_3_score.vgm
Binary file not shown.
Binary file added data/deflemask/player_4_score.dmf
Binary file not shown.
Binary file added data/deflemask/player_4_score.vgm
Binary file not shown.
Binary file added data/deflemask/player_shot.dmf
Binary file not shown.
Binary file added data/deflemask/player_shot.vgm
Binary file not shown.
Binary file added data/deflemask/rescue_diver.dmf
Binary file not shown.
Binary file added data/deflemask/rescue_diver.vgm
Binary file not shown.
Binary file added data/player_1_score.psg
Binary file not shown.
Binary file added data/player_2_score.psg
Binary file not shown.
Binary file added data/player_3_score.psg
Binary file not shown.
Binary file added data/player_4_score.psg
Binary file not shown.
Binary file added data/player_shot.psg
Binary file not shown.
Binary file added data/rescue_diver.psg
Binary file not shown.

0 comments on commit 80d7bde

Please sign in to comment.