Page 1 of 1

Problem With Switching Between Options In A Main Menu

PostPosted: Thu Jun 16, 2016 12:33 pm
by PerrySteven
Hello, recently I have began work on one of my game projects. I have decided to start with the main menu first but I have encountered some problems. This is the structure I have:

Blank screen with text showing some credits
>Clickable actor: Moon
Code: Select all
If the left mouse button is clicked on, the actor "view" will move to (-400, -960) with velocity 5 relative to Game Centre avoiding none.

Code: Select all
If the left mouse button is clicked on, the actor "Moon" will have all events disabled.

>Controllable actor: view
Code: Select all
When move is finish, do the following in script mode:
activate_options = 1;
option = 1;
ChangeTransparency("tall_tree", 0.500000);
ChangeTransparency("new_game_text", 0.500000);
EventDisable("view", EVENTALL);

>Status: Actions up to this point are carried out successfully
>Note: The variables are GLOBAL INTEGERS.

Blank screen with several actors
>Controllable actors: tall_tree, new_game_text
Code: Select all
Key Down (Left):
if((activate_options == 1) && (option == 1))
{
    ChangeTransparency("tall_tree", 0.000000);
    ChangeTransparency("new_game_text", 0.000000);
 

   ChangeTransparency("quit", 0.000000);
    ChangeTransparency("quit_text", 0.000000);
 

   option = 3;
};

Code: Select all
Key Down (Right):
if((activate_options == 1) && (option == 1))
{
    ChangeTransparency("tall_tree", 0.000000);
    ChangeTransparency("new_game_text", 0.000000);

    ChangeTransparency("continue_game", 0.500000);
    ChangeTransparency("continue_game_text", 0.500000);

    option = 2;
};

>Controllable actors: continue_game, continue_game_text
Code: Select all
Key Down (Left):
if((activate_options == 1) && (option == 2))
{
    ChangeTransparency("tall_tree", 0.500000);
    ChangeTransparency("new_game_text", 0.500000);
 

   ChangeTransparency("continue_game", 0.000000);
    ChangeTransparency("continue_game_text", 0.000000);
 

   option = 1;
};

Code: Select all
Key Down (Right):
if((activate_options == 1) && (option == 2))
{
    ChangeTransparency("continue_game", 0.000000);
    ChangeTransparency("continue_game_text", 0.000000);
 

   ChangeTransparency("quit", 0.500000);
    ChangeTransparency("quit_text", 0.500000);


    option = 3;

};

>Controllable actors: quit, quit_text
Code: Select all
if((activate_options == 1) && (option == 3))
{
    ChangeTransparency("quit", 0.000000);
    ChangeTransparency("quit_text", 0.000000);
 

   ChangeTransparency("continue_game", 0.500000);
    ChangeTransparency("continue_game_text", 0.500000);
 

   option = 2;
};

Code: Select all
Key Down (Right):
if((activate_options == 1) && (option == 3))
{
    ChangeTransparency("quit", 0.000000);
    ChangeTransparency("quit_text", 0.000000);
 

   ChangeTransparency("tall_tree", 0.500000);
    ChangeTransparency("new_game_text", 0.500000);


    option = 1;
};


All the key down functions have the following parameters:
Code: Select all
Execute when: At least one key is pressed
Repeat: Enable

And when an actor is selected its transparency is 0.5.

My problem begins with switching between the actors. It's very jerky, and for some reason the continue_game and continue_game_actors are skipped and I can't move left to select the quit actor. I checked my code over and over, but I can't see a bug. Does anyone know what's wrong?

Re: Problem With Switching Between Options In A Main Menu

PostPosted: Fri Jun 24, 2016 2:23 am
by PerrySteven
Well nevermind about that. I found a successful work around and neatened up my variable and actor names.

Re: Problem With Switching Between Options In A Main Menu

PostPosted: Fri Jun 24, 2016 12:35 pm
by lcl
PerrySteven wrote:Well nevermind about that. I found a successful work around and neatened up my variable and actor names.

Good to hear. Generally, if you need help with something as complicated as your question was, you're much more likely to get help if you upload your project .ged and data attached to your post, so people can actually try your code and see what's wrong. And if you don't feel like sharing your whole project to everyone (which is often quite understandable), you can always make a small example .ged with the code that is misbehaving, and people can then use that to help you.

Re: Problem With Switching Between Options In A Main Menu

PostPosted: Sun Jun 26, 2016 4:45 am
by PerrySteven
lcl wrote:
PerrySteven wrote:Well nevermind about that. I found a successful work around and neatened up my variable and actor names.

Good to hear. Generally, if you need help with something as complicated as your question was, you're much more likely to get help if you upload your project .ged and data attached to your post, so people can actually try your code and see what's wrong. And if you don't feel like sharing your whole project to everyone (which is often quite understandable), you can always make a small example .ged with the code that is misbehaving, and people can then use that to help you.


Ahh, I see. Thanks for the tip!