Skip to content

Commit

Permalink
update main script
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMagicFlute committed Apr 23, 2023
1 parent dbd04d0 commit 5584bac
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions scrKillPlayer.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
script: YoYoYo Engine (GMS1) Sctipt - scrKillplayer (RANDOM DEATHSOUND VER);
version: 1.1.0 (bug fixed) 2023-4-23;
Author: TheMagicFlute;
feature: kills the player and play the random death sound;
usage: scrkillPlayer();
*/

//requirements: 3 sounds resource: musDeath1, musDeath2, musDeath3!

var mus, music; //define variables

mus = irandom_range(1,3);

if (mus)
{
if (mus == 1)
{
music = musDeath1; // mus1
}
if (mus == 2)
{
music = musDeath2; // mus2
}
if (mus == 3)
{
music = musDeath3; // mus3
}
}

if (mus) && (music)
{
if (instance_exists(objPlayer) && (!global.noDeath && !global.debugNoDeath))
{
if (global.gameStarted) //normal death
{
global.deathSound = audio_play_sound(sndDeath,0,false);

if (!global.muteMusic) //play death music
{
audio_pause_sound(global.currentMusic);

audio_play_sound(sndDeath, 1, false);

global.gameOverMusic = audio_play_sound(music,1,false);
}

with (objPlayer)
{
instance_create(x,y,objBloodEmitter);
instance_destroy();
}

instance_create(0,0,objGameOver);

global.death += 1; //increment deaths

scrSaveGame(false); //save death/time
}
else //death in the difficulty select room, restart the room
{
with(objPlayer)
instance_destroy();

room_restart();
}
}
}

0 comments on commit 5584bac

Please sign in to comment.