Game freezes when main character dies.
#1
Posted 28 March 2012 - 04:37 PM
#2
Posted 28 March 2012 - 04:39 PM
There's not much we can do if you don't post the code/D+D
But did you check to see it's exiting any loops/reset any variables.
Also what GM version is this?
#3
Posted 28 March 2012 - 04:43 PM
The code im using is the following in a step event of a "obj_control" object.
if global.ammo>100 global.ammo=100 if global.hp>200 global.hp=200 if global.hp<1 room_restart() if global.hp<1 sound_play(uhoh)
#4
Posted 28 March 2012 - 04:46 PM
if global.ammo > 100 global.ammo = 100; if global.hp > 200 global.hp = 200; if global.hp < 1 room_restart() if global.hp < 1 sound_play(uhoh); global.hp = 100;
Edited by fluidic ice, 28 March 2012 - 04:47 PM.
#5
Posted 28 March 2012 - 04:52 PM
#6
Posted 28 March 2012 - 04:55 PM
if global.ammo > 100 global.ammo = 100;
if global.hp > 200 global.hp = 200;
if global.hp <= 0 {sound_play(uhoh); global.hp = 100; room_restart();}
Edited by fluidic ice, 28 March 2012 - 04:56 PM.
#7
Posted 28 March 2012 - 04:59 PM
Huge thanks for the help btw.
#8
Posted 28 March 2012 - 05:04 PM
Your welcomeHuge thanks for the help btw.
Err is this controller or room persistant by any chance?
If not:
if global.ammo > 100 global.ammo = 100;
if global.hp > 200 global.hp = 200;
if global.hp <= 0 {sound_play(uhoh); global.hp = 100; Obj_player.x = xstart; Obj_player.y = ystart; room_restart();}Change the Obj_player to the object name of your player.
Edited by fluidic ice, 28 March 2012 - 05:08 PM.
#9
Posted 28 March 2012 - 05:08 PM
EDIT: just noticed that the controller is persistant, could this be whats causing the error?
Edited by Boxcar, 28 March 2012 - 05:09 PM.
#10
Posted 28 March 2012 - 05:09 PM
#11
Posted 28 March 2012 - 05:21 PM
#12
Posted 28 March 2012 - 05:30 PM
#13
Posted 28 March 2012 - 05:43 PM
#14
Posted 28 March 2012 - 05:49 PM
Edited by fluidic ice, 28 March 2012 - 05:49 PM.
#15
Posted 28 March 2012 - 06:13 PM
if global.ammo > 100
{
global.ammo = 100;
}
if global.hp > 200
{
global.hp = 200;
}
if global.hp <= 0
{
sound_play(uhoh);
global.hp = 100;
Obj_player.x = Obj_player.xstart;
Obj_player.y = Obj_player.ystart;
room_restart();
}Also I added brackets and indents to clean the code up a bit..
#16
Posted 28 March 2012 - 06:20 PM
Edited by fluidic ice, 28 March 2012 - 06:35 PM.
#17
Posted 28 March 2012 - 06:34 PM
Is there any way i can make this work with persistent rooms? Because if i have persistent rooms now the enemies doesnt respawn.
#18
Posted 28 March 2012 - 06:45 PM
That did it! Thanks a lot the both of you!
![]()
That sentence cancelled itself out?Is there any way i can make this work with persistent rooms? Because if i have persistent rooms now the enemies doesnt respawn.
Why do you need the room persistant what don't you want respawning when you come back?
#19
Posted 28 March 2012 - 06:53 PM
I hope that clears it up
#20
Posted 28 March 2012 - 07:02 PM
From this I gathered you want only the enemies to respawn every time the room is restarted?Is there any way i can make this work with persistent rooms? Because if i have persistent rooms now the enemies doesnt respawn.
But there you said you don't want them to respawn. And the players respawning should work with the room persistant.I want to be able to move between rooms without them changing back to their original state (ie medkits and ammokits respawning, enemies respawning etc.etc.)
If you did want enemies to respawn each time the map is loaded:
You could use a controller in the room to create enemies in random spots around the room, or have them created in specific spots such as:
instance_create(200,300,obj_enemy); instance_create(400,100,obj_enemy);
Edited by fluidic ice, 28 March 2012 - 07:09 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











