Skip to content

Commit

Permalink
fix item pickup and prepare to clear tech debt
Browse files Browse the repository at this point in the history
  • Loading branch information
splch committed May 24, 2022
1 parent 19b6389 commit 0ffadc1
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 10 deletions.
Binary file modified build/duck/Pirates Folly.duck
Binary file not shown.
Binary file modified build/gb/Pirates Folly.gb
Binary file not shown.
Binary file modified build/gbc/Pirates Folly.gbc
Binary file not shown.
Binary file modified build/pocket/Pirates Folly.pocket
Binary file not shown.
6 changes: 3 additions & 3 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#define SCREEN_WIDTH DEVICE_SCREEN_WIDTH / 2 // metatiles are 16x16
#define SCREEN_HEIGHT DEVICE_SCREEN_HEIGHT / 2
#define CENTER_X SCREEN_WIDTH / 2
#define CENTER_Y SCREEN_HEIGHT / 2 + 1
#define CENTER_X_PX SCREEN_WIDTH * 8 + 8 // 8 pixels per tile, move right 8 pixels
#define CENTER_Y_PX SCREEN_HEIGHT * 8 + 8 // move down 8 pixels
#define CENTER_Y SCREEN_HEIGHT / 2 + 2
#define CENTER_X_PX SCREEN_WIDTH * 8 - 8 // 8 pixels per tile, move right 8 pixels
#define CENTER_Y_PX SCREEN_HEIGHT * 8 + 8 // move up 8 pixels
// ----------------- //

#define bool uint8_t
Expand Down
9 changes: 2 additions & 7 deletions src/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,13 @@ uint8_t generate_item(uint8_t x, uint8_t y)
bool is_removed(const uint8_t x, const uint8_t y)
{
// returns true if item has been picked up at (x, y)
printf("%u, %u\n", x + 1, arr_4kb[x + 1]);
waitpad(0b11111111);
return arr_4kb[x + 1] == y + 2;
return arr_4kb[x] == y - 4;
}

void remove_item(const uint8_t x, const uint8_t y)
{
// item has been picked up at (x, y)
printf("%u, %u\n", x + 1, y + 2);
delay(1000);
waitpad(0b11111111);
arr_4kb[x + 1] = y + 2;
arr_4kb[x] = y;
}

void shift_array_right()
Expand Down

0 comments on commit 0ffadc1

Please sign in to comment.