Make the game a bit more actionfilled

- Level 1 is reduced in size
- More monsters spawn
- Maps are more 'messy' and less linear
- Introduces 'space' to hold your turn
This commit is contained in:
Linus Probert 2018-09-09 12:43:17 +02:00
parent c65d6907e5
commit b3724afe49
7 changed files with 39 additions and 33 deletions

View File

@ -50,8 +50,8 @@ local function generate_path ()
local lastDirection = 0 local lastDirection = 0
local coridoor_count = 0 local coridoor_count = 0
local bossLevel = CURRENT_LEVEL % 5 == 0 local bossLevel = CURRENT_LEVEL % 5 == 0
local coverage = 9 + CURRENT_LEVEL local coverage = 8 + CURRENT_LEVEL
if bossLevel then if bossLevel or CURRENT_LEVEL == 1 then
coverage = 5 coverage = 5
end end
@ -61,15 +61,7 @@ local function generate_path ()
while matrix_coverage(map_matrix) < coverage do while matrix_coverage(map_matrix) < coverage do
local direction = random(4) local direction = random(4)
if lastDirection > 0 then if coridoor_count < coverage/2 then
if random(24) <= 6 then direction = lastDirection end
end
while lastDirection == reverse_direction(direction) do
direction = random(4)
end
if coridoor_count < coverage/3 then
if random(3) == 1 and (cx > 1 or cy > 1) then if random(3) == 1 and (cx > 1 or cy > 1) then
map_matrix[cx][cy].type = "coridoor" map_matrix[cx][cy].type = "coridoor"
coridoor_count = coridoor_count + 1 coridoor_count = coridoor_count + 1

View File

@ -300,7 +300,9 @@ local enemies = {}
if(CURRENT_LEVEL > 0) then if(CURRENT_LEVEL > 0) then
if (CURRENT_LEVEL == 1) then if (CURRENT_LEVEL == 1) then
enemies = concat(enemies, pests) enemies = concat(enemies, pests)
enemies = concat(enemies, avian)
enemies = concat(enemies, misc) enemies = concat(enemies, misc)
enemies = concat(enemies, dogs)
elseif (CURRENT_LEVEL > 15) then elseif (CURRENT_LEVEL > 15) then
enemies = {} enemies = {}
enemies = concat(enemies, undead) enemies = concat(enemies, undead)
@ -342,6 +344,7 @@ function module.add_monsters_to_room(room, roomx, roomy)
if (CURRENT_LEVEL > 3) then if (CURRENT_LEVEL > 3) then
count = random(4) count = random(4)
end end
count = count + 1
local i = 0 local i = 0
while i < count do while i < count do
local rx = random(13) + 1 local rx = random(13) + 1

View File

@ -91,6 +91,8 @@ get_event_key(SDL_Event *event)
key = KEY_ESC; break; key = KEY_ESC; break;
case SDLK_RETURN: case SDLK_RETURN:
key = KEY_ENTER; break; key = KEY_ENTER; break;
case SDLK_SPACE:
key = KEY_SPACE; break;
default: default:
key = 0; break; key = 0; break;
} }

View File

@ -22,22 +22,23 @@
#include <SDL.h> #include <SDL.h>
#include <stdbool.h> #include <stdbool.h>
#define KEY_LEFT 1 #define KEY_LEFT 0x1
#define KEY_RIGHT 2 #define KEY_RIGHT 0x2
#define KEY_UP 4 #define KEY_UP 0x4
#define KEY_DOWN 8 #define KEY_DOWN 0x8
#define KEY_NUM0 16 #define KEY_NUM0 0x10
#define KEY_NUM1 32 #define KEY_NUM1 0x20
#define KEY_NUM2 64 #define KEY_NUM2 0x40
#define KEY_NUM3 128 #define KEY_NUM3 0x80
#define KEY_NUM4 256 #define KEY_NUM4 0x100
#define KEY_NUM5 512 #define KEY_NUM5 0x200
#define KEY_NUM6 1024 #define KEY_NUM6 0x400
#define KEY_NUM7 2048 #define KEY_NUM7 0x800
#define KEY_NUM8 4096 #define KEY_NUM8 0x1000
#define KEY_NUM9 8192 #define KEY_NUM9 0x2000
#define KEY_ESC 16384 #define KEY_ESC 0x4000
#define KEY_ENTER 32768 #define KEY_ENTER 0x8000
#define KEY_SPACE 0x10000
#define KEY_CTRL_M 0x1 #define KEY_CTRL_M 0x1
#define KEY_CTRL_S 0x2 #define KEY_CTRL_S 0x2
@ -47,11 +48,11 @@
#define KEY_SHIFT_NUM3 0x20 #define KEY_SHIFT_NUM3 0x20
#define KEY_SHIFT_NUM4 0x40 #define KEY_SHIFT_NUM4 0x40
#define KEY_SHIFT_NUM5 0x80 #define KEY_SHIFT_NUM5 0x80
#define KEY_CTRL_F 0x100 #define KEY_CTRL_F 0x100
#define MBUTTON_LEFT 1 #define MBUTTON_LEFT 0x1
#define MBUTTON_MIDDLE 2 #define MBUTTON_MIDDLE 0x2
#define MBUTTON_RIGHT 4 #define MBUTTON_RIGHT 0x4
typedef struct Input { typedef struct Input {
Uint64 keyState; Uint64 keyState;

View File

@ -103,6 +103,8 @@ static char *how_to_play_tooltip[] = {
"", "",
" ATTACK: Walk into a monster to attack it", " ATTACK: Walk into a monster to attack it",
"", "",
" HOLD TURN: Press SPACE",
"",
" THROW DAGGER: Press 4 then chose a direction (nav keys)", " THROW DAGGER: Press 4 then chose a direction (nav keys)",
"", "",
" DRINK HEALTH: Press 5 (if you need health and have potions)", " DRINK HEALTH: Press 5 (if you need health and have potions)",

View File

@ -306,6 +306,12 @@ handle_next_move(UpdateData *data)
if (linkedlist_size(player->projectiles) > 0) if (linkedlist_size(player->projectiles) > 0)
return; return;
if (input_key_is_pressed(data->input, KEY_SPACE)) {
action_spent(data->player);
gui_log("You take a moment and stare at your feet");
return;
}
RoomMatrix *matrix = data->matrix; RoomMatrix *matrix = data->matrix;
Vector2d nextDir = read_direction_from(data->input); Vector2d nextDir = read_direction_from(data->input);
if (!vector2d_equals(nextDir, VECTOR2D_NODIR)) if (!vector2d_equals(nextDir, VECTOR2D_NODIR))

View File

@ -62,7 +62,7 @@ static char *bash_tooltip[] = {
" On a successful hit the target will be stunned for 2 turns", " On a successful hit the target will be stunned for 2 turns",
"", "",
"COOLDOWN:", "COOLDOWN:",
" 2 turns", " 3 turns",
"", "",
"USAGE:", "USAGE:",
" activate the skill (press 2)", " activate the skill (press 2)",
@ -335,7 +335,7 @@ create_bash(void)
Skill *skill = create_default("Bash", s); Skill *skill = create_default("Bash", s);
skill->levelcap = 3; skill->levelcap = 3;
skill->instantUse = false; skill->instantUse = false;
skill->resetTime = 2; skill->resetTime = 3;
skill->available = NULL; skill->available = NULL;
skill->use = skill_bash; skill->use = skill_bash;
skill->actionRequired = true; skill->actionRequired = true;