Add project code

This commit is contained in:
Andrew Trieu
2025-04-20 15:57:23 +03:00
committed by Andrew Trieu
commit 3fbd0e4977
612 changed files with 11196 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
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;
// Weapon pickup
global.weapon_notification = "";
global.weapon_notification_timer = 0;
menu_inst = noone;

37
objects/o_hud/Draw_0.gml Normal file
View File

@@ -0,0 +1,37 @@
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]);
var _padding = 10;
var _hud_x = _cam_x + _padding;
var _hud_y = _cam_y + _padding;
if instance_exists(o_player) && !instance_exists(o_screen_pause) {
draw_sprite(s_player_health, 0, _hud_x, _hud_y);
for (var i = 0; i < player_max_hp / 10; i++) {
var _img = 1;
if i + 1 <= player_hp / 10 { _img = 2; };
var _sep = 6;
draw_sprite(s_player_health, _img, _hud_x + _sep * i, _hud_y);
}
draw_sprite(s_kill_count, 0, _hud_x, _hud_y + 20);
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 notification if active
if (global.weapon_notification != "") {
draw_set_font(fnt_Tiny5);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
// Draw at top center of screen
draw_text_transformed(_hud_x + 23, _hud_y + 40, global.weapon_notification , 0.5, 0.5, 0);
}

View File

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

26
objects/o_hud/Step_0.gml Normal file
View File

@@ -0,0 +1,26 @@
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;
player_max_hp = o_player.max_hp;
} else {
player_hp = 0;
}
if (global.weapon_notification_timer > 0) {
global.weapon_notification_timer--;
if (global.weapon_notification_timer <= 0) {
global.weapon_notification = "";
}
}
if (global.enemyKillCount >= global.enemyRoomMax) {
instance_create_depth(0, 0, -10000, o_end_screen);
}

38
objects/o_hud/o_hud.yy generated Normal file
View File

@@ -0,0 +1,38 @@
{
"$GMObject":"",
"%Name":"o_hud",
"eventList":[
{"$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",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":5,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
],
"managed":true,
"name":"o_hud",
"overriddenProperties":[],
"parent":{
"name":"Controllers",
"path":"folders/Controllers.yy",
},
"parentObjectId":null,
"persistent":true,
"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,
}