[ 4 posts ]  Reply to topicPost new topic 
Author Message
 [us]
 Post subject: Pause "LOZ: Oracles of Seasons/Ages" style, HELP!
PostPosted: Tue Dec 13, 2016 10:54 pm 
User avatar
"I am one valuable card"
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
Image

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



Alarm [1]
Code:
// Screen gamma
if (alpha < 1) {
alpha+=0.3;
alarm[1]=1;
}
else {
displaypause = 1
alpha = 1
alarm[2]=1;
}


Alarm [2]
Code:
// Screen gamma
if (alpha <= 1) {
alpha-=0.3;
alarm[2]=1;
}


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



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()
}



OBJ_PAUSEFADE
Create Event
Code:
alpha=0;
alarm[0]=1;


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
}


Alarm[1]
Code:
// Screen gamma
if (alpha <= 1) {
alpha-=0.3;
alarm[1]=1;
}
else {
game_end();
}


Draw Event
Code:
draw_sprite_ext(spr_pausefade,0,view_xview[0],view_yview[0],320, 240,0,c_white, alpha);


Is it OK for you to help me?

_________________
Image
Image

Image
NNID: SonicZetrex
User: SonicZetrx


Old Drawing Banners

Spoiler:

Things I support/others

Spoiler:


My favorite theme:

 
Top
Offline 
 User page at mfgg.net
 
 [zz]
 Post subject: Re: Pause "LOZ: Oracles of Seasons/Ages" style, HELP!
PostPosted: Tue Dec 13, 2016 11:20 pm 
User avatar
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
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: [ Download ] [ Hide ]
Using gml Syntax Highlighting
if (alpha <= 1)
 


...should be this (considering the other parts of that event):

Syntax: [ Download ] [ Hide ]
Using gml Syntax Highlighting
if (alpha <= 0)
 


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.

_________________
Image
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Pause "LOZ: Oracles of Seasons/Ages" style, HELP!
PostPosted: Wed Dec 14, 2016 8:28 pm 
User avatar
"I am one valuable card"
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
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.

_________________
Image
Image

Image
NNID: SonicZetrex
User: SonicZetrx


Old Drawing Banners

Spoiler:

Things I support/others

Spoiler:


My favorite theme:

 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Pause "LOZ: Oracles of Seasons/Ages" style, HELP!
PostPosted: Thu Dec 15, 2016 9:34 am 
User avatar
"I am one valuable card"
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
I am honestly surprised I did it very well! This may be the better solution:

OBJ_PAUSE
Code:
///The pause menu


//Pause particles
part_system_automatic_update(1,0)

//Deactivate everything
instance_deactivate_all(1)

//Take a screenshot
back = background_create_from_surface(application_surface,0,0,640,480,0,0)

//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;
alarm[0]=25;
allow = false
displaypause= 0
flash = 0
alarm[3] = 20


Alarm[0]
allow = true

Alarm[1]
Code:
// Screen gamma
if (alpha < 1) {
alpha+=0.3;
alarm[1]=1;
}
else {
alpha = 1
displaypause= 1
alarm[2]=1;
}


Alarm[2]
Code:
// Screen gamma
if (alpha <= 1) {
alpha-=0.3;
alarm[2]=1;
}


Alarm[3]
Code:
alarm[3] = 20
if (!flash)
    flash = true
else
    flash = false


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);

draw_set_font(global.numbers)
draw_set_color(c_white)
draw_set_alpha(1)


"Enter" Event
Code:
///Unpause the game
if allow = true
{
//Play the pause sound
audio_play_sound(snd_pause,0,0)

//Delete the screenshot
if background_exists(back)
    background_delete(back)

//Resume particles
part_system_automatic_update(1,1)
global.pause = 0

instance_create(view_xview[0],view_yview[0],obj_pausefade)

allow = false
//Activate everything
instance_activate_all()

}




OBJ_PAUSEFADE

Create
Code:
alpha=0;
alarm[0]=1;


Alarm[0]
Code:
// Screen gamma
if (alpha < 1) {
alpha+=0.3;
obj_pause.displaypause -= 0.3
alarm[0]=1;
}
else {
alarm[1] = 1
}


Alarm[1]
Code:
// Screen gamma
if (alpha >= 0) {
alpha-=0.3;
alarm[1]=3;
}
else
{
with(obj_pause)
instance_destroy();
with(obj_camera)
alarm[1] = 25
instance_destroy();
}


Draw
Code:
draw_sprite_ext(spr_pausefade,0,view_xview[0],view_yview[0],320, 240,0,c_white, alpha);


I know it supposed to be for "Coding Help", but still, This is the solution I've got! But still, thanks for lending me a hand. :)

_________________
Image
Image

Image
NNID: SonicZetrex
User: SonicZetrx


Old Drawing Banners

Spoiler:

Things I support/others

Spoiler:


My favorite theme:

 
Top
Offline 
 User page at mfgg.net
 
« Previous topic | Next topic »
Display posts from previous:  Sort by  
 [ 4 posts ]  Reply to topicPost new topic 


Who is online

Users browsing this topic: No registered users and 1 guest


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
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group