Official Fangame Help Topic

Woah, what the-… Okay then. Are you still actively here or did you just come here because someone replied to this topic and you got an email saying so?

acually i’m kinda glad this was bumped i gotta few questions to ask about GM. How do I make a selection screen at the start of my game for selelcting characters.

Umm … there is a lot of ways this can be done, is using the mouse a part of the game? Or just keyboard?

Here is a method similar to what I used for my key selection when changing keys:

“Selector” Object:

Event Create:

x =
y = // Depending on how the “selector” gets displayed, you might want to set these to the default selected posiiton

Selected =

Event Up: // Assuming this is vertical selection (pressing up/down)

if(Selected > 0)
{
Selected-=1
y-=<distance between 1 selection and the next>
}

Event Down: // Assuming this is vertical selection (pressing up/down)

if(Selected < )
{
Selected+=1
y+=<distance between 1 selection and the next>
}

Event Enter:

switch(Selected)
{
case 0:
break
case 1:
break

}

For something like player selection you will probably want to set a global variable to the selected player object. Then upon entering the room for the start of the game create the object stored in that global variable at the starting position of the player.

If your “selection” isnt in the form of a list like my Up/Down, instead it could be a grid. Then instead of just Selected, use SelectedX and SelectedY … on up/down increment/decrement SelectedY … on left/right increment/decrement SelectedX. When you press enter to select, you could add to that case structure… but a better way might be to store all the player object variables in a 2D array before hand, then draw from them like: global.Player1 = Character[SelectedX][SelectedY] … or something like that.

Hope I wasnt too cryptic for you … =/

It’s just slightly on-topic since this is Game-Maker related, but…

My friend took the GML quiz and got “Experienced User” by pressing A repeatedly. :slight_smile:

wow… Another question.

When I make a shooting object for my ship in my game, how can I make it so that i could just old down the button to shoot?

just the keyboard event (rather than keypress)

or use step event combined with (vk_whatever)

how do i make a variable global?

add global. before it

This is now the official Game Maker help topic. Bring any discussion from the other topics into this one. This is for Game Maker questions or questions about how you would do things in GM fangames.

Sweet Idea, it should be pinned.

wut the? Czar i told u to put global. in messenger. didnt i?

yea but when i asked you how to make global variables, you were like “Global, before name, G2G Bye”<___<

And it didnt work btw. Speaking of you why aren’t you gone i thought you had to go…<_______________________<

offtopic: im at my friends computer (at his house)

well global variables didnt work unless i did something wrong.

When you declare ANY variable you should ALWAYS initialise it first. You technically dont need to do it in GM, but if you dont you might have forgotten which scope your working in. For the room creation event for hte first room put global.variable = 0. Remember that all variables are case sensitive. After declaring a global variable like that it can then be used by ANY object AFTER it has been declared.

and of course, variables should they not be declared and remain something like var_whatever, they are put down as local when created, if not stated at global.var_whatever.

also, stating global after creating a variable is not always necesarry. :smiley:

oh i went globalvariable_1 not global.variable_1, my mistake.

Edit: Still doesnt work.

To rephrase what SmartDude47 said:

Always declare variables in the lowest scope possible to save memory. By that I mean, if it doesnt need to be a global, DONT make it a global. This is true for real programming languages as well.

Sorry SD47, I just thought when you said it, it came off a bit confusing…

ok but it still doesnt work DH.

um…got a file we can look at…?..actually i just got here, sorry, let me go back and read your problem…

also, np restating what i said tenka…i…dont really care, lol.