hp=20;
hp_prev = hp;
max_hp = hp;
hunger = 20;
dead=false;
@ -262,12 +263,15 @@ sit_spr = spr_player_sit;
<argument>
<kind>1</kind>
<string>///hunger
alarm[2] = room_speed*20;
if !(hunger == 0){
hunger -= 1;
}else{
hp -= 1;
if (!is_local)
{
alarm[2] = room_speed*20;
if !(hunger == 0)
{
hunger -= 1;
}else{
hp -= 1;
}
}
</string>
</argument>
@ -667,7 +671,7 @@ move_from_instance(obj_tile_entity,1);
<argument>
<kind>1</kind>
<string>///stats
hp = round(clamp(hp,0,20));
hp = round(clamp(hp,0,max_hp));
hunger = round(clamp(hunger,0,20));
switch (gamemode){
case "Creative":
@ -676,7 +680,10 @@ switch (gamemode){
dead = false;
break;
case "Survival":
if (!is_local)
{
hunger = 20;
}
break;
default:
@ -742,8 +749,10 @@ if ! (candamage){
if (hp != hp_prev){
if (hp_prev>hp){
candamage = false;
if (!outside_view){
audio_sound_pitch(hurt_sound,random_range(0.8,1.2));
audio_play_sound(hurt_sound,1,0)
}
}
hp_prev = hp;
}
@ -831,6 +840,11 @@ if (keyboard_check_pressed(ord("4"))){
<argument>
<kind>1</kind>
<string>///
if (keyboard_check_pressed(ord("H")) && is_local)
{
instance_create(x,y,obj_fellow);
}
</string>
</argument>
</arguments>
@ -978,18 +992,26 @@ if ds_map_find_value(async_load, "status") == 0{
<argument>
<kind>1</kind>
<string>///draw name
if ((is_local) && (showOfflineNameBar)){
if ((string_count("@",name) >= 1) && (is_local)){draw_set_colour(c_desert_sand)}
displayname = string_replace(name,"@","|");
}else{
displayname = string_replace(name,"@","");
}
if (debug)
{
displayname = displayname + "HP:"+string(hp);
}
if (instance_exists(obj_inventory)){
if (obj_inventory.visible){
if name != ""{
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_sprite_ext(spr_nametag,0,x,y-40+z,string_width(string_replace(name,"@",""))/16,0.5,0,c_white,0.33);
if ((is_local) && (showOfflineNameBar)){
if ((string_count("@",name) >= 1) && (is_local)){draw_set_colour(c_desert_sand)}
draw_text(x,y-40+z,string_replace(name,"@","|"));
}else{
draw_text(x,y-40+z,string_replace(name,"@",""));
}
draw_sprite_ext(spr_nametag,0,x,y-40+z,string_width(displayname)/16,0.5,0,c_white,0.33);
draw_text(x,y-40+z,displayname);
draw_set_colour(c_white)
draw_set_halign(fa_left);
draw_set_valign(fa_top);
@ -1046,7 +1068,7 @@ if (instance_exists(obj_inventory) && (is_local)){
if !(instance_exists(obj_pause_menu)){
mouse_use = lerp(mouse_use,mouse_check_button(mb_left)*45*sin(current_time/69),0.1);
}
draw_sprite_ext(obj_inventory.mouse_slot_id,0,x,y-20+z,1*dirofv,1,mouse_use,image_blend,image_alpha)
draw_sprite_ext(asset_get_index(obj_inventory.mouse_slot_id),0,x,y-20+z,1*dirofv,1,mouse_use,image_blend,image_alpha)
}
</string>
</argument>
0 comments