Add more menus and endless mode

This commit is contained in:
Andrew Trieu
2025-04-20 22:37:10 +03:00
committed by Andrew Trieu
parent d2beb3540a
commit 2f75df211f
44 changed files with 651 additions and 65 deletions

View File

@@ -0,0 +1 @@
depth = -10000;

View File

@@ -0,0 +1,41 @@
var _cam_x = camera_get_view_x(view_camera[0]);
var _cam_w = camera_get_view_width(view_camera[0]);
var _cam_y = camera_get_view_y(view_camera[0]);
var _cam_h = camera_get_view_height(view_camera[0]);
draw_rectangle_color(_cam_x, _cam_y, _cam_w + _cam_x, _cam_h + _cam_y, c_black, c_black, c_black, c_black, false);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_font(fnt_Tiny5);
draw_text_transformed(_cam_x + 10, _cam_y, "Credits", 2, 2, 0);
var pulse = 1 + 0.05 * sin(current_time * 0.01);
draw_sprite_ext(s_key_back, image_index, _cam_x + 610, _cam_y + 45, 0.5 + pulse, 0.5 + pulse, 0, c_white, 1);
draw_text_transformed(_cam_x + 225, _cam_y + 20, "-< Press Backspace to return", pulse, pulse, 0);
draw_set_halign(fa_center);
// Credit Text Lines
var credit_lines = [
"Developed by Andrew Trieu",
"Character & Item Sprites by Zerie",
"Tile Set by Butter Milk",
"Spells & Spawner by BDragon1727",
"Explosive Crate by Akonolisa",
"Explosion Animation by Pixel Frog",
"Keyboard Icons by ansdor",
"Fonts by Google Fonts",
"Background Music by David Renda",
"Hit Sound by Homemade_SFX",
"Healing & Item Pickup Sound by Freesound Community",
"Explosion Sound by Ahmed_Abdulaal"
];
// Draw each line spaced vertically
var base_y = _cam_y + 80;
var spacing = 20;
for (var i = 0; i < array_length(credit_lines); i++) {
draw_text_transformed(_cam_x + (_cam_w / 2), base_y + i * spacing, credit_lines[i], 0.5, 0.5, 1);
}
draw_set_halign(fa_left);
draw_set_valign(fa_top);

View File

@@ -0,0 +1,5 @@
if global.back_key_pressed {
instance_destroy();
instance_create_depth(0, 0, -9000, o_start_menu);
}

40
objects/o_credits/o_credits.yy generated Normal file
View File

@@ -0,0 +1,40 @@
{
"$GMObject":"",
"%Name":"o_credits",
"eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_credits",
"overriddenProperties":[],
"parent":{
"name":"Controllers",
"path":"folders/Controllers.yy",
},
"parentObjectId":{
"name":"o_screen_pause",
"path":"objects/o_screen_pause/o_screen_pause.yy",
},
"persistent":false,
"physicsAngularDamping":0.1,
"physicsDensity":0.5,
"physicsFriction":0.2,
"physicsGroup":1,
"physicsKinematic":false,
"physicsLinearDamping":0.1,
"physicsObject":false,
"physicsRestitution":0.1,
"physicsSensor":false,
"physicsShape":1,
"physicsShapePoints":[],
"physicsStartAwake":true,
"properties":[],
"resourceType":"GMObject",
"resourceVersion":"2.0",
"solid":false,
"spriteId":null,
"spriteMaskId":null,
"visible":true,
}

View File

@@ -12,6 +12,10 @@ draw_set_valign(fa_middle);
draw_set_font(fnt_Tiny5);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) - 20, "YOU WON!", 4, 4, 0);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 50, "-< Press any key to continue >-", 1, 1, 0);
draw_set_valign(fa_bottom);
draw_text_transformed(_cam_x + (_cam_w / 2) - 120, _cam_y + _cam_h - 30, "Current Score: " + string(global.current_score), 0.5, 0.5, 0);
draw_text_transformed(_cam_x + (_cam_w / 2) + 120, _cam_y + _cam_h - 30, "High Score: " + string(global.high_score), 0.5, 0.5, 0);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_alpha(1);

View File

@@ -2,8 +2,14 @@ alpha += alpha_spd;
alpha = clamp(alpha, 0, 1);
if keyboard_check_pressed(vk_anykey) && alpha >= 1 {
global.enemyRoomMax += 100;
global.enemyActiveMax += 20;
global.enemy_room_max += 100;
global.enemy_active_max += 20;
global.first_start = false;
if (global.current_score >= global.high_score) {
global.high_score = global.current_score;
save_high_score();
}
room_restart();
}

View File

@@ -13,6 +13,10 @@ draw_set_font(fnt_Special_Elite);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) - 20, "YOU DIED", 4, 4, 0);
draw_set_font(fnt_Tiny5);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 50, "-< Press any key to resurrect >-", 1, 1, 0);
draw_set_valign(fa_bottom);
draw_text_transformed(_cam_x + (_cam_w / 2) - 120, _cam_y + _cam_h - 30, "Current Score: " + string(global.current_score), 0.5, 0.5, 0);
draw_text_transformed(_cam_x + (_cam_w / 2) + 120, _cam_y + _cam_h - 30, "High Score: " + string(global.high_score), 0.5, 0.5, 0);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_alpha(1);

View File

@@ -3,5 +3,13 @@ alpha = clamp(alpha, 0, 1);
if keyboard_check_pressed(vk_anykey) && alpha >= 1 {
global.first_start = false;
if (global.current_score >= global.high_score) {
global.high_score = global.current_score;
save_high_score();
}
global.current_score = 0;
room_restart()
}

View File

@@ -13,7 +13,10 @@
"name":"Controllers",
"path":"folders/Controllers.yy",
},
"parentObjectId":null,
"parentObjectId":{
"name":"o_screen_pause",
"path":"objects/o_screen_pause/o_screen_pause.yy",
},
"persistent":false,
"physicsAngularDamping":0.1,
"physicsDensity":0.5,

View File

@@ -1,14 +1,18 @@
depth = -9000;
global.first_start = true;
player_hp = 0;
player_max_hp = 0;
global.enemyRoomMax = 100;
global.enemyActiveMax = 20;
global.totalEnemiesSpawned = 0;
global.enemyKillCount = 0;
global.enemy_room_max = 100;
global.enemy_active_max = 20;
global.total_enemies_spawned = 0;
global.kill_count = 0;
global.first_start = true;
global.current_score = 0;
load_high_score();
global.infinite_mode = false;
// Weapon pickup
global.weapon_notification = "";

View File

@@ -22,8 +22,12 @@ if instance_exists(o_player) && !instance_exists(o_screen_pause) {
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_font(fnt_Tiny5);
draw_text_transformed(_hud_x + 28, _hud_y + 23, string(global.enemyKillCount) , 0.5, 0.5, 0);
draw_text_transformed(_hud_x + 49, _hud_y + 23, " / " + string(global.enemyRoomMax), 0.5, 0.5, 0);
draw_text_transformed(_hud_x + 28, _hud_y + 23, string(global.kill_count) , 0.5, 0.5, 0);
if !global.infinite_mode {
draw_text_transformed(_hud_x + 49, _hud_y + 23, " / " + string(global.enemy_room_max), 0.5, 0.5, 0);
}
}
// Draw notification if active

View File

@@ -1,5 +1,5 @@
global.totalEnemiesSpawned = 0;
global.enemyKillCount = 0;
global.total_enemies_spawned = 0;
global.kill_count = 0;
global.weapon_notification = "";
global.weapon_notification_timer = 0;

View File

@@ -1,11 +1,3 @@
if global.first_start {
menu_inst = instance_create_depth(0, 0, -10000, o_start_menu)
}
if global.start_key_pressed && instance_exists(menu_inst) {
instance_destroy(menu_inst);
}
// Get player's hp
if instance_exists(o_player) {
player_hp = o_player.hp;
@@ -21,6 +13,10 @@ if (global.weapon_notification_timer > 0) {
}
}
if (global.enemyKillCount >= global.enemyRoomMax) {
if (global.kill_count >= global.enemy_room_max) {
if (global.current_score >= global.high_score) {
global.high_score = global.current_score;
save_high_score();
}
instance_create_depth(0, 0, -10000, o_end_screen);
}

View File

@@ -8,4 +8,7 @@ global.heal_key_pressed = 0;
global.start_key_pressed = 0;
global.space_key_pressed = 0;
global.back_key_pressed = 0;
global.pause_key_pressed = 0;
global.pause_key_pressed = 0;
global.shift_key_pressed = 0;
global.one_key_pressed = 0;
global.two_key_pressed = 0;

View File

@@ -1,10 +1,19 @@
global.start_key_pressed = keyboard_check_pressed(vk_enter);
global.space_key_pressed = keyboard_check_pressed(vk_space);
global.back_key_pressed = keyboard_check_pressed(vk_backspace)
global.back_key_pressed = keyboard_check_pressed(vk_backspace);
global.shift_key_pressed = keyboard_check_pressed(vk_shift);
if (!instance_exists(o_start_menu) && !instance_exists(o_tutorial) && !instance_exists(o_credits) && !instance_exists(o_mode_menu)) {
global.pause_key_pressed = keyboard_check_pressed(vk_escape);
} else {
global.pause_key_pressed = false;
}
if instance_exists(o_start_menu) || instance_exists(o_tutorial) {
exit;
global.one_key_pressed = keyboard_check_pressed(ord("1"));
global.two_key_pressed = keyboard_check_pressed(ord("2"));
if instance_exists(o_start_menu) || instance_exists(o_tutorial) || instance_exists(o_credits) || instance_exists(o_mode_menu) {
exit;
}
global.right_key = keyboard_check(ord("D"));
@@ -13,6 +22,4 @@ global.up_key = keyboard_check(ord("W"));
global.down_key = keyboard_check(ord("S"));
global.shoot_key = mouse_check_button(mb_left);
global.swap_key_pressed = mouse_check_button_pressed(mb_right);
global.heal_key_pressed = keyboard_check(ord("Q"));
global.pause_key_pressed = keyboard_check_pressed(vk_escape);
global.heal_key_pressed = keyboard_check(ord("Q"));

View File

@@ -0,0 +1 @@
depth = -10000;

View File

@@ -0,0 +1,40 @@
var _cam_x = camera_get_view_x(view_camera[0]);
var _cam_w = camera_get_view_width(view_camera[0]);
var _cam_y = camera_get_view_y(view_camera[0]);
var _cam_h = camera_get_view_height(view_camera[0]);
draw_rectangle_color(_cam_x, _cam_y, _cam_w + _cam_x, _cam_h + _cam_y, c_black, c_black, c_black, c_black, false);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_font(fnt_Tiny5);
draw_text_transformed(_cam_x + 10, _cam_y, "Modes", 2, 2, 0);
draw_sprite_ext(s_key_back, image_index, _cam_x + 610, _cam_y + 45, 1.5, 1.5, 0, c_white, 1);
draw_text_transformed(_cam_x + 240, _cam_y + 20, "-< Press Backspace to return", 1, 1, 0);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) - 70, "Gauntlet Rush", 1.5, 1.5, 0);
draw_sprite_ext(s_key_one, image_index, _cam_x + (_cam_w / 2) + 150, _cam_y + (_cam_h / 2) - 55, 2, 2, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 50, "Endless Swarm", 1.5, 1.5, 0);
draw_sprite_ext(s_key_two, image_index, _cam_x + (_cam_w / 2) + 160, _cam_y + (_cam_h / 2) + 65, 2, 2, 0, c_white, 1);
draw_set_alpha(0.7);
draw_set_valign(fa_top);
draw_text_transformed(
_cam_x + (_cam_w / 2),
_cam_y + (_cam_h / 2) - 40,
"Start with 40 enemies and fight through 100 kills.\nEach round increases difficulty. How long can you survive?",
0.8, 0.8, 0
);
draw_text_transformed(
_cam_x + (_cam_w / 2),
_cam_y + (_cam_h / 2) + 80,
"Face as many enemies at once as you can in an endless battle.\nNo kill limit. Healing is rare. Just survive.",
0.8, 0.8, 0
);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_alpha(1);

View File

@@ -0,0 +1,16 @@
if global.back_key_pressed {
instance_destroy();
instance_create_depth(0, 0, -9000, o_start_menu);
}
if global.one_key_pressed {
instance_destroy();
}
if global.two_key_pressed {
global.infinite_mode = true;
global.enemy_active_max = 100;
instance_destroy();
}

40
objects/o_mode_menu/o_mode_menu.yy generated Normal file
View File

@@ -0,0 +1,40 @@
{
"$GMObject":"",
"%Name":"o_mode_menu",
"eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_mode_menu",
"overriddenProperties":[],
"parent":{
"name":"Controllers",
"path":"folders/Controllers.yy",
},
"parentObjectId":{
"name":"o_screen_pause",
"path":"objects/o_screen_pause/o_screen_pause.yy",
},
"persistent":false,
"physicsAngularDamping":0.1,
"physicsDensity":0.5,
"physicsFriction":0.2,
"physicsGroup":1,
"physicsKinematic":false,
"physicsLinearDamping":0.1,
"physicsObject":false,
"physicsRestitution":0.1,
"physicsSensor":false,
"physicsShape":1,
"physicsShapePoints":[],
"physicsStartAwake":true,
"properties":[],
"resourceType":"GMObject",
"resourceVersion":"2.0",
"solid":false,
"spriteId":null,
"spriteMaskId":null,
"visible":true,
}

View File

@@ -1,4 +1,4 @@
event_inherited();
get_damaged_create(100);
global.totalEnemiesSpawned++;
global.total_enemies_spawned++;

View File

@@ -1,11 +1,17 @@
if sprite_index == sprites[4] {
global.enemyKillCount++;
global.kill_count++;
global.current_score++;
// Drop healing milk
var _drop_chance = 10;
if global.infinite_mode {
_drop_chance = 5;
}
var _chance = irandom(100);
if global.enemyKillCount mod 20 == 0 || _chance <= _drop_chance {
if ((!global.infinite_mode && global.kill_count mod 20 == 0) || _chance <= _drop_chance) {
instance_create_depth(x, y, -600, o_potion);
}

View File

@@ -11,6 +11,10 @@ draw_set_font(fnt_Tiny5);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) - 20, "PAUSED", 4, 4, 0);
draw_sprite_ext(s_key_esc, image_index, _cam_x + (_cam_w / 2) + 160, _cam_y + (_cam_h / 2) + 60, 1.5, 1.5, 0, c_white, alpha);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 50, "-< Press ESC to resume", 1, 1, 0);
draw_set_valign(fa_bottom);
draw_text_transformed(_cam_x + (_cam_w / 2) - 120, _cam_y + _cam_h - 30, "Current Score: " + string(global.current_score), 0.5, 0.5, 0);
draw_text_transformed(_cam_x + (_cam_w / 2) + 120, _cam_y + _cam_h - 30, "High Score: " + string(global.high_score), 0.5, 0.5, 0);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_alpha(1);

View File

@@ -1,4 +1,8 @@
if sprite_index == sprites[4] {
if (global.current_score >= global.high_score) {
global.high_score = global.current_score;
save_high_score();
}
instance_create_depth(0, 0, -10000, o_game_over);
instance_destroy();
}

View File

@@ -9,6 +9,11 @@ var pause_key_pressed = global.pause_key_pressed;
// Pause game
if pause_key_pressed {
if (global.current_score >= global.high_score) {
global.high_score = global.current_score;
save_high_score();
}
if !instance_exists(o_pause_menu) {
instance_create_depth(0, 0, -10000, o_pause_menu);
} else {

View File

@@ -3,8 +3,10 @@ if pause_movement() { exit; }
timer++;
// Reset when limit reached
if instance_number(o_parent_enemy) >= global.enemyActiveMax || global.totalEnemiesSpawned >= global.enemyRoomMax {
timer = 0;
if !global.infinite_mode {
if instance_number(o_parent_enemy) >= global.enemy_active_max || global.total_enemies_spawned >= global.enemy_room_max {
timer = 0;
}
}
// Spawn enemy

View File

@@ -1,3 +1 @@
alpha = 1;
depth = -9000;

View File

@@ -3,22 +3,37 @@ var _cam_w = camera_get_view_width(view_camera[0]);
var _cam_y = camera_get_view_y(view_camera[0]);
var _cam_h = camera_get_view_height(view_camera[0]);
draw_set_alpha(alpha);
draw_rectangle_color(_cam_x, _cam_y, _cam_w + _cam_x, _cam_h + _cam_y, c_green, c_green, c_green, c_green, false);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_font(fnt_Tiny5);
draw_text_transformed(_cam_x + 6, _cam_y + 6, "Quit", 0.5, 0.5, 0);
draw_sprite_ext(s_key_esc, image_index, _cam_x + 38, _cam_y + 19, 0.8, 0.8, 0, c_white, 1);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_font(fnt_Tiny5);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) - 40, "Bit Blaster", 4, 4, 0);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) - 70, "Bit Blaster", 4, 4, 0);
var pulse = 1 + 0.05 * sin(current_time * 0.01);
if global.first_start {
draw_sprite_ext(s_key_enter, image_index, _cam_x + (_cam_w / 2) + 160, _cam_y + (_cam_h / 2) + 40, 0.5 + pulse, 0.5 + pulse, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 30, "-< Press Enter to start", pulse, pulse, 0);
draw_sprite_ext(s_key_enter, image_index, _cam_x + (_cam_w / 2) + 160, _cam_y + (_cam_h / 2) + 20, 0.5 + pulse, 0.5 + pulse, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 10, "-< Press Enter to start", pulse, pulse, 0);
} else {
draw_sprite_ext(s_key_enter, image_index, _cam_x + (_cam_w / 2) + 180, _cam_y + (_cam_h / 2) + 40, 0.5 + pulse, 0.5 + pulse, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 30, "-< Press Enter to continue", pulse, pulse, 0);
draw_sprite_ext(s_key_enter, image_index, _cam_x + (_cam_w / 2) + 180, _cam_y + (_cam_h / 2) + 20, 0.5 + pulse, 0.5 + pulse, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 10, "-< Press Enter to continue", pulse, pulse, 0);
}
draw_sprite_ext(s_key_space, image_index, _cam_x + (_cam_w / 2) + 180, _cam_y + (_cam_h / 2) + 80, 1.5, 1.5, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 70, "-< Press Space for tutorial", 1, 1, 0);
draw_sprite_ext(s_key_space, image_index, _cam_x + (_cam_w / 2) + 180, _cam_y + (_cam_h / 2) + 60, 1.5, 1.5, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 50, "-< Press Space for tutorial", 1, 1, 0);
draw_sprite_ext(s_key_space, image_index, _cam_x + (_cam_w / 2) + 180, _cam_y + (_cam_h / 2) + 60, 1.5, 1.5, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 50, "-< Press Space for tutorial", 1, 1, 0);
draw_sprite_ext(s_key_shift, image_index, _cam_x + (_cam_w / 2) + 170, _cam_y + (_cam_h / 2) + 99, 1.5, 1.5, 0, c_white, 1);
draw_text_transformed(_cam_x + (_cam_w / 2), _cam_y + (_cam_h / 2) + 90, "-< Press Shift for credits", 1, 1, 0);
draw_set_valign(fa_bottom);
draw_text_transformed(_cam_x + (_cam_w / 2) - 120, _cam_y + _cam_h - 30, "Current Score: " + string(global.current_score), 0.5, 0.5, 0);
draw_text_transformed(_cam_x + (_cam_w / 2) + 120, _cam_y + _cam_h - 30, "High Score: " + string(global.high_score), 0.5, 0.5, 0);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_alpha(1);

View File

@@ -1,10 +1,22 @@
if global.start_key_pressed {
instance_destroy();
global.first_start = false;
instance_create_depth(0, 0, -10000, o_mode_menu);
}
if global.space_key_pressed {
instance_destroy();
instance_create_depth(0, 0, -10000, o_tutorial);
}
}
if global.shift_key_pressed {
instance_destroy();
instance_create_depth(0, 0, -10000, o_credits);
}
if global.pause_key_pressed {
game_end();
}

View File

@@ -2,17 +2,4 @@ alpha = 1;
depth = -10000;
image_speed = 0.2;
icons = {
wasd: s_key_wasd,
mouse_left: s_mouse_left,
mouse_right: s_mouse_right,
heal: s_key_q,
skeleton: s_key_wasd,
milk: s_key_wasd,
wizard: s_key_wasd,
tree: s_key_wasd,
stump: s_key_wasd,
coal: s_key_wasd,
};
image_speed = 0.2;