Skip to content

Commit

Permalink
Merge pull request #1 from sardap/v0.0.6
Browse files Browse the repository at this point in the history
V0.0.6
  • Loading branch information
sardap authored Jan 30, 2021
2 parents 3c86043 + 3294627 commit 34e07c2
Show file tree
Hide file tree
Showing 32 changed files with 1,135 additions and 864 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ log/

assets/whale/*.png
assets/enemy/*.png
assets/background/*.png
assets/text/*.png
assets/weapons/*.png

assets/out.png
__debug_bin
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"program": "mGBA.exe",
"args": [
"${workspaceFolder}\\bin\\ecs.gba"
"${workspaceFolder}\\bin\\walk-good-maybe.gba"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"C_Cpp.errorSquiggles": "Disabled",
"cSpell.words": [
"allc",
"ents"
]
}
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LIBTONC := $(DEVKITPRO)/tonclib $(DEVKITPRO)/libtonc
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET := bin/ecs
TARGET := bin/walk-good-maybe
MUSIC_TARGET := bin/music
BUILD := build
ASSETS := assets assets/title_screen assets/whale
Expand Down Expand Up @@ -136,6 +136,7 @@ assets: $(shell find assets/ -type f -name '.psd')
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).gba $(MUSIC_OUPUT).gba
@rm -rf "source/assets"

#---------------------------------------------------------------------------------
else
Expand Down
Binary file removed assets/background/background.png
Binary file not shown.
Binary file removed assets/background/backgroundBuildingA.png
Binary file not shown.
Binary file removed assets/background/backgroundCity.png
Binary file not shown.
Binary file removed assets/background/backgroundSky.png
Binary file not shown.
Binary file removed assets/background/background_night.png
Binary file not shown.
Binary file removed assets/background/background_size_test.png
Binary file not shown.
Binary file removed assets/background/build_tile_set.png
Binary file not shown.
Binary file removed assets/background/buildingtileset.png
Binary file not shown.
Binary file removed assets/background/cloud.png
Binary file not shown.
Binary file removed assets/background/fog.png
Binary file not shown.
Binary file removed assets/text/numbersfont.png
Binary file not shown.
Binary file removed assets/weapons/gun_0_bullet.png
Binary file not shown.
3 changes: 1 addition & 2 deletions make_assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@ BG_OPTIONS="$BG_OPTIONS -m" # Export map
BG_OPTIONS="$BG_OPTIONS -mR8" # Create Map
BG_OPTIONS="$BG_OPTIONS -mLs" # Map 16 Bit
BG_OPTIONS="$BG_OPTIONS -pS" # Share pallet
BG_OPTIONS="$BG_OPTIONS -gS" # Share tiles
BG_OPTIONS="$BG_OPTIONS -O mainGameShared" # Shared pallet name

echo "Creating background tiles for main game / pal / map"
grit \
$ASSETS/backgrounds_out.png \
$ASSETS/background/fog.png \
$ASSETS/background/backgroundCity.png \
$ASSETS/background/build_tile_set.png $BG_OPTIONS
$ASSETS/background/buildingtileset.png $BG_OPTIONS


BG_OPTIONS=""
Expand Down
Binary file added music/pd_beach_song.xm
Binary file not shown.
71 changes: 40 additions & 31 deletions source/enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,67 +14,76 @@
#include "assets/toast_enemy_idle_05.h"

const uint *enemy_toast_idle_cycle[] = {
toast_enemy_idle_01Tiles, toast_enemy_idle_01Tiles, toast_enemy_idle_02Tiles,
toast_enemy_idle_03Tiles, toast_enemy_idle_04Tiles, toast_enemy_idle_05Tiles
};
toast_enemy_idle_01Tiles, toast_enemy_idle_01Tiles, toast_enemy_idle_02Tiles,
toast_enemy_idle_03Tiles, toast_enemy_idle_04Tiles, toast_enemy_idle_05Tiles};

static int _enemy_top_idx = 0;
static int _enemy_tile_idx;
static int _enemy_anime_cycle = 0;

void load_enemy_toast() {
_enemy_tile_idx = allocate_tile_idx(2);
void load_enemy_toast()
{
_enemy_tile_idx = allocate_obj_tile_idx(2);
dma3_cpy(&tile_mem[4][_enemy_tile_idx], toast_enemy_idle_01Tiles, toast_enemy_idle_01TilesLen);
}


void create_toast_enemy(ent_t *ent, FIXED x, FIXED y) {
void create_toast_enemy(ent_t *ent, int att_idx, FIXED x, FIXED y)
{
ent->ent_type = TYPE_ENEMY;

ent->x = x;
ent->w = 8;
ent->y = y;
ent->h = 16;
ent->vx = 0;
ent->vy = 0;
ent->w = 8;
ent->h = 16;
ent->att_idx = allocate_att(1);
ent->att_idx = att_idx;

obj_set_attr(&_obj_buffer[ent->att_idx],
ATTR0_TALL | ATTR0_8BPP, ATTR1_SIZE_8x16,
ATTR2_PALBANK(0) | ATTR2_PRIO(1) | ATTR2_ID(_enemy_tile_idx)
);
obj_set_attr(
get_ent_att(ent),
ATTR0_TALL | ATTR0_8BPP, ATTR1_SIZE_16x8,
ATTR2_PRIO(1) | ATTR2_ID(_enemy_tile_idx));

obj_set_pos(&_obj_buffer[ent->att_idx], fx2int(ent->x), fx2int(ent->y));
obj_set_pos(get_ent_att(ent), fx2int(ent->x), fx2int(ent->y));
}

void destroy_toast_enemy(ent_t *ent) {
ent->att_idx = 0;
void step_enemy_global()
{
if (frame_count() % 2)
{
step_anime(
enemy_toast_idle_cycle, toast_enemy_idle_01TilesLen, ENEMY_TOAST_IDLE_CYCLE,
&_enemy_anime_cycle, _enemy_tile_idx);
}
}

void update_enemy(ent_t *ent) {
if(ent->x + ent->w < 0) {
void update_enemy(ent_t *ent)
{
if (ent->x + ent->w < 0 || ent->ent_cols & (TYPE_BULLET))
{
free_att(1, ent->att_idx);
destroy_toast_enemy(ent);
ent->ent_type = TYPE_NONE;
return;
}

step_anime(
enemy_toast_idle_cycle, toast_enemy_idle_01TilesLen, ENEMY_TOAST_IDLE_CYCLE,
&ent->anime_cycle, _enemy_tile_idx
);

bool hit_y = ent_move_y(ent, ent->vy);
// Applies gravity
if(!hit_y) {
if(ent->vy < TERMINAL_VY) {
if (!hit_y)
{
if (ent->vy < TERMINAL_VY)
{
ent->vy += GRAVITY;
}
ent->vx = 0;
} else {
if(ent->vx == 0) {
}
else
{
if (ent->vx == 0)
{
ent->vx = float2fx(0.75);
}
int hit_x = ent_level_collision_at(ent, ent->vx, ent->vy);
if(!hit_x) {
if (!hit_x)
{
ent->vx = -ent->vx;
}
}
Expand Down
4 changes: 3 additions & 1 deletion source/enemy.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ extern const unsigned int *enemy_toast_idle_cycle[];

void load_enemy_toast();

void create_toast_enemy(ent_t *ent, FIXED x, FIXED y);
void create_toast_enemy(ent_t *ent, int att_idx, FIXED x, FIXED y);

void update_enemy(ent_t *ent);

void step_enemy_global();

#endif
Loading

0 comments on commit 34e07c2

Please sign in to comment.