Comunidad Game Maker

Ayuda => Preguntas y respuestas => Mensaje iniciado por: Gerald_Shiko en Septiembre 08, 2015, 06:03:29 AM

Título: Ayuda con este problema (solucionado)
Publicado por: Gerald_Shiko en Septiembre 08, 2015, 06:03:29 AM
como no pude reiniciar una room desde otra room hice lo siguiente:
puse un objeto controlador que guarda el game al iniciar el room, luego cuando pierdo me envía a un room gameover (aquí tengo un boton que carga el game que guardé al principio del nivel y da el efecto de reiniciar el nivel) todo iba perfecto hasta que hice un jefe con barra de vida, al cargar el game me sale un error que parece ocacionarlo la barra:

este es el error:___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object barra_obj:

Push :: Execution Error - Variable Get -1.limite(100002, -2147483648)
at gml_Object_barra_obj_DrawEvent_1 (line 4) - estreche = global.salud/limite*300;
############################################################################################

este es el objeto de barra de vida:

Sprite: barra_spr
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:

No Physics Object
Create Event:

execute code:

limite = global.salud;

Draw Event:

execute code:

draw_sprite (barra_spr,0,x,y)

var estreche;
estreche = global.salud/limite*300;

draw_sprite_stretched (barra_spr,1,x,y,estreche,32 )

if global.salud <= 50 {draw_sprite_stretched (barra_spr,2,x,y,estreche,32 );}
if global.salud <= 20 {draw_sprite_stretched (barra_spr,3,x,y,estreche,32 );}
draw_sprite (topbar_spr,0,x,y) ;

este es el controlador que guarda todo al comenzar un nivel:
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:

No Physics Object
Create Event:

save the game in the file restart
Keyboard Event for Key:

Restart the current room
display message: nivel reiniciado
Keyboard Event for Key:

save the game in the file savegame
Go to room pausar



este es el botón (en el room gameover que carga el game):

Sprite: iniciar
Solid: false
Visible: true
Depth: 0
Persistent: true
Parent:
Children:
Mask:

No Physics Object
Create Event:

set the sprite to iniciar with subimage 0 and speed 0
Mouse Event for Left Pressed:

play sound bit; looping: false
load the game from the file restart
Mouse Event for Mouse Enter:

set the sprite to iniciar with subimage 1 and speed 0
Mouse Event for Mouse Leave:

set the sprite to iniciar with subimage 0 and speed 0

gracias de antemano, ayer pasé casi todo el día en esto :/
Título: Re:Ayuda con este problema
Publicado por: Gerald_Shiko en Septiembre 08, 2015, 06:41:30 AM
ya lo solucioné xD : lo que hice fué quitar la barra de vida del room y luego en el evento create del jefe que este creara la barra de vida, pero estaré atento a sus respuestas, ustedes saben más que yo :)