//Draw the screenshot if it exists if background_exists(back) { draw_enable_alphablend(0) draw_background(back,view_xview[0],view_yview[0]) draw_enable_alphablend(1) }
with obj_pause instance_destroy(); sound_stop_all(); << I used to put it there, but it will ignore the alarm[0] now and focus on the alarm[1] transition_kind = 21 }
[img]http://i.imgur.com/yDSpBcU.gif[/img]
It seems to be hard for me to go through for the "Legend Of Zelda look-alike" game. Here is my code from what I put in before:
Create
[code]///The pause menu
//Pause particles
part_system_automatic_update(1,0)
//Take a screenshot
back = background_create_from_surface(application_surface,0,0,640,480,0,0)
//Deactivate everything
instance_deactivate_all(1)
//Activate the persistent object
instance_activate_object(obj_control)
//Play the pause sound
audio_play_sound(snd_pause,0,0)
global.pause = 1
alpha = 0
alarm[1]=1;
displaypause= 0
[/code]
Alarm [1]
[code]// Screen gamma
if (alpha < 1) {
alpha+=0.3;
alarm[1]=1;
}
else {
displaypause = 1
alpha = 1
alarm[2]=1;
}[/code]
Alarm [2]
[code]// Screen gamma
if (alpha <= 1) {
alpha-=0.3;
alarm[2]=1;
}[/code]
Draw Event
[code]///Draw the pause menu
//Draw the screenshot if it exists
if background_exists(back)
{
draw_enable_alphablend(0)
draw_background(back,view_xview[0],view_yview[0])
draw_enable_alphablend(1)
}
draw_sprite_ext(spr_pause, 0, view_xview[0], view_yview[0], 1, 1,0,c_white, displaypause);
draw_sprite_ext(spr_pausefade, 0, view_xview[0], view_yview[0], 320, 240,0,c_white, alpha); << Important
[/code]
Enter (this is where the problem made me to a stop.)
[code]///Unpause the game
if allow = true
{
//Resume particles
part_system_automatic_update(1,1)
//Delete the screenshot
if background_exists(back)
background_delete(back)
//Play the pause sound
audio_play_sound(snd_pause,0,0)
global.pause = 0
instance_create(view_xview[0],view_yview[0],obj_pausefade)
allow = false
//Activate everything
instance_activate_all()
}[/code]
OBJ_PAUSEFADE
Create Event
[code]alpha=0;
alarm[0]=1;[/code]
Alarm[0]
[code]// Screen gamma
if (alpha < 1) {
alpha+=0.3;
alarm[0]=1;
}
else {
with obj_pause
instance_destroy();
sound_stop_all();
<< I used to put it there, but it will ignore the alarm[0] now and focus on the alarm[1]
transition_kind = 21
}[/code]
Alarm[1]
[code]// Screen gamma
if (alpha <= 1) {
alpha-=0.3;
alarm[1]=1;
}
else {
game_end();
}
[/code]
Draw Event
[code]draw_sprite_ext(spr_pausefade,0,view_xview[0],view_yview[0],320, 240,0,c_white, alpha);[/code]
Is it OK for you to help me?
Number 2, the allow variable should be initialized in a spot that is executed before the Enter event (such as the Create event). I don't see it initialized before the code in the Enter event, which checks out the allow variable, a variable doesn't exist. This will cause errors to show up. It shouldn't be too hard to fix.
Finally, number 3, this might be minor, but what are exactly the particle codes for? I'm not familiar with particles, but it doesn't seem like they really do anything, unless you told me otherwise.
Also, this is just a suggestion that doesn't really have to do much with your game, but I think you should post these kind of topics in the Coding Help topic. I think one of the reasons that topic existed is so that the Developer Discussion could be less filled with topics about coding issues. Also, you might sometimes actually get more help in there, especially considering that it's a sticky topic.
I looked through the code, and there is a few things that seem to be wrong. Number one, the alarm 2 event should have this:
[syntax=gml]
if (alpha <= 1)
[/syntax]
...should be this (considering the other parts of that event):
[syntax=gml]
if (alpha <= 0)
[/syntax]
Number 2, the allow variable should be initialized in a spot that is executed before the Enter event (such as the Create event). I don't see it initialized before the code in the Enter event, which checks out the allow variable, a variable doesn't exist. This will cause errors to show up. It shouldn't be too hard to fix.
Finally, number 3, this might be minor, but what are exactly the particle codes for? I'm not familiar with particles, but it doesn't seem like they really do anything, unless you told me otherwise.
Also, this is just a suggestion that doesn't really have to do much with your game, but I think you should post these kind of topics in the Coding Help topic. I think one of the reasons that topic existed is so that the Developer Discussion could be less filled with topics about coding issues. Also, you might sometimes actually get more help in there, especially considering that it's a sticky topic.
Post subject: Re: Pause "LOZ: Oracles of Seasons/Ages" style, HELP!
Posted: Wed Dec 14, 2016 8:28 pm
"I am one valuable card"
Huh. Never knew that "Coding Help" exists. Thanks for letting me know and thank you for that error thing (it works well on the other alarm in "
obj_pause
")
*Also, the reason I removed "allow" is because they are unnecessary to the topic I'm trying to get at.
Huh. Never knew that "Coding Help" exists. Thanks for letting me know and thank you for that error thing (it works well on the other alarm in "[pre]obj_pause[/pre]")
*Also, the reason I removed "allow" is because they are unnecessary to the topic I'm trying to get at.
//Draw the screenshot if it exists if background_exists(back) { draw_enable_alphablend(0) draw_background(back,view_xview[0],view_yview[0]) draw_enable_alphablend(1) }
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum