A quick start to the Mage

This commit is contained in:
Linus Probert 2019-05-06 13:48:40 +02:00
parent fcc6527a93
commit 826cbe11ff
3 changed files with 11 additions and 7 deletions

View File

@ -405,6 +405,8 @@ on_character_select(const char *str)
playerClass = WARRIOR; playerClass = WARRIOR;
else if (strcmp(str, "rogue") == 0) else if (strcmp(str, "rogue") == 0)
playerClass = ROGUE; playerClass = ROGUE;
else if (strcmp(str, "mage") == 0)
playerClass = MAGE;
startGame(); startGame();
} }

View File

@ -106,22 +106,25 @@ menu_create_character_selector(void (*onCharacterSelect)(const char *), Camera *
{ {
const char *spriteSheets[] = { const char *spriteSheets[] = {
"Commissions/Warrior.png", "Commissions/Warrior.png",
"Commissions/Rogue.png" "Commissions/Rogue.png",
"Commissions/Mage.png"
}; };
static char *callbackData[] = { static char *callbackData[] = {
"warrior", "warrior",
"rogue" "rogue",
"mage"
}; };
static char *descriptions[] = { static char *descriptions[] = {
"Play as the warrior", "Play as the warrior",
"Play as the rogue", "Play as the rogue",
"Play as the mage"
}; };
Menu *menu = menu_create(); Menu *menu = menu_create();
int xoffset = 224; int xoffset = 168;
for (size_t i = 0; i < 2; ++i) { for (size_t i = 0; i < 3; ++i) {
Sprite *s1 = sprite_create(); Sprite *s1 = sprite_create();
sprite_set_texture(s1, texturecache_add(spriteSheets[i]), 0); sprite_set_texture(s1, texturecache_add(spriteSheets[i]), 0);
s1->clip = CLIP16(0, 48); s1->clip = CLIP16(0, 48);
@ -139,7 +142,7 @@ menu_create_character_selector(void (*onCharacterSelect)(const char *), Camera *
menu_item_add(menu, s1, s2, (void (*)(void *)) onCharacterSelect); menu_item_add(menu, s1, s2, (void (*)(void *)) onCharacterSelect);
MenuItem *item = linkedlist_get(&menu->items, (Uint32) i); MenuItem *item = linkedlist_get(&menu->items, (Uint32) i);
item->button->usrdata = callbackData[i]; item->button->usrdata = callbackData[i];
xoffset += 224; xoffset += 168;
linkedlist_append(&menu->descriptions, descriptions[i]); linkedlist_append(&menu->descriptions, descriptions[i]);
} }

View File

@ -553,7 +553,6 @@ player_create(class_t class, Camera *cam)
player->skills[0] = skill_create(BACKSTAB, cam); player->skills[0] = skill_create(BACKSTAB, cam);
player->skills[1] = skill_create(TRIP, cam); player->skills[1] = skill_create(TRIP, cam);
player->skills[2] = skill_create(PHASE, cam); player->skills[2] = skill_create(PHASE, cam);
player->skills[3] = skill_create(DAGGER_THROW, cam);
player->daggers = 10; player->daggers = 10;
break; break;
case WARRIOR: case WARRIOR:
@ -562,10 +561,10 @@ player_create(class_t class, Camera *cam)
player->skills[0] = skill_create(FLURRY, cam); player->skills[0] = skill_create(FLURRY, cam);
player->skills[1] = skill_create(BASH, cam); player->skills[1] = skill_create(BASH, cam);
player->skills[2] = skill_create(CHARGE, cam); player->skills[2] = skill_create(CHARGE, cam);
player->skills[3] = skill_create(DAGGER_THROW, cam);
break; break;
} }
player->skills[3] = skill_create(DAGGER_THROW, cam);
player->skills[4] = skill_create(SIP_HEALTH, cam); player->skills[4] = skill_create(SIP_HEALTH, cam);
sprite_load_texture(player->sprite, asset, 0, cam->renderer); sprite_load_texture(player->sprite, asset, 0, cam->renderer);