Mercurial > molko
diff examples/example-battle/main.c @ 230:86b71e1f9dd5
rpg: add movements in battle
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 23 Nov 2020 17:05:07 +0100 |
parents | befa2e855d3b |
children | fb304a94a05c |
line wrap: on
line diff
--- a/examples/example-battle/main.c Thu Nov 19 16:46:26 2020 +0100 +++ b/examples/example-battle/main.c Mon Nov 23 17:05:07 2020 +0100 @@ -81,7 +81,7 @@ ch->mpmax = ch->mp = 38; ch->atk = 22; ch->def = 19; - ch->agt = 21; + ch->agt = 11; ch->luck = 14; } @@ -93,23 +93,14 @@ .hp = 120, .mp = 50, .reset = adventurer_reset, - .sprite = ®istry_sprites[REGISTRY_TEXTURE_JOHN], + .sprites = { + [CHARACTER_SPRITE_WALK] = ®istry_sprites[REGISTRY_TEXTURE_JOHN_WALK], + [CHARACTER_SPRITE_SWORD] = ®istry_sprites[REGISTRY_TEXTURE_JOHN_SWORD], + }, .spells = { &spell_fire } }, - { - .name = "Fake Molko", - .type = "Adventurer", - .level = 1, - .hp = 120, - .mp = 50, - .reset = adventurer_reset, - .sprite = ®istry_sprites[REGISTRY_TEXTURE_JOHN], - .spells = { - &spell_fire - } - } }; static void @@ -135,7 +126,9 @@ .type = "Wood", .level = 30, .reset = haunted_wood_reset, - .sprite = ®istry_sprites[REGISTRY_TEXTURE_HAUNTED_WOOD], + .sprites = { + [CHARACTER_SPRITE_WALK] = ®istry_sprites[REGISTRY_TEXTURE_HAUNTED_WOOD], + }, .exec = haunted_wood_strat }; @@ -144,7 +137,9 @@ .type = "Cat", .level = 6, .reset = black_cat_reset, - .sprite = ®istry_sprites[REGISTRY_TEXTURE_BLACK_CAT], + .sprites = { + [CHARACTER_SPRITE_WALK] = ®istry_sprites[REGISTRY_TEXTURE_BLACK_CAT], + }, .exec = black_cat_strat }; @@ -171,11 +166,13 @@ // bt->enemies[0].ch = &haunted_wood; bt->team[0].ch = &team[0]; - bt->team[1].ch = &team[1]; + //bt->team[1].ch = &team[1]; /* Positionate the single ennemy to the left. */ align(ALIGN_LEFT, - &bt->enemies[0].x, &bt->enemies[0].y, haunted_wood.sprite->cellw, haunted_wood.sprite->cellh, + &bt->enemies[0].x, &bt->enemies[0].y, + haunted_wood.sprites[0]->cellw, + haunted_wood.sprites[0]->cellh, 0, 0, window.w, window.h); /* Black cat is near the previous monster. */ @@ -183,6 +180,8 @@ bt->enemies[1].x = 500; bt->enemies[1].y = 100; + bt->background = ®istry_images[REGISTRY_IMAGE_BATTLE_BACKGROUND]; + battle_start(bt); fight_state.data = bt;