Problem With Switching Between Options In A Main Menu

Learn how to start making games.

Problem With Switching Between Options In A Main Menu

Postby PerrySteven » Thu Jun 16, 2016 12:33 pm

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?
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score

Re: Problem With Switching Between Options In A Main Menu

Postby PerrySteven » Fri Jun 24, 2016 2:23 am

Well nevermind about that. I found a successful work around and neatened up my variable and actor names.
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score

Re: Problem With Switching Between Options In A Main Menu

Postby lcl » Fri Jun 24, 2016 12:35 pm

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.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Problem With Switching Between Options In A Main Menu

Postby PerrySteven » Sun Jun 26, 2016 4:45 am

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!
User avatar
PerrySteven
 
Posts: 46
Joined: Sun Jan 25, 2015 4:29 am
Location: Malaysia
Score: 1 Give a positive score


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 1 guest