Page 1 of 1

Character select...

PostPosted: Sat Oct 06, 2012 6:24 am
by Goomba
Well here I am again asking questions hopinf for some easy answers... anyway, quick question... how do you make a character select? would I use variables some how? or an array? or what? I need to make a character select before each level... someone help! :(

Re: Character select...

PostPosted: Sat Oct 06, 2012 7:13 am
by skydereign
Think of it this way, what is the character select, and what does it do? It is most likely a collection of characters (icons that represent each one), that when you click one, it selects that character. To set that up you need two things, the character icons, and a way for the game to know which character you selected.

The character icons could be done in many different ways. First is to have a single image with all the icons (but this means you can't use mouse button down on individual characters). Another way is to have multiple actors, each with the animation of a different actor (this uses a lot of actors, and since the actors are so similar, you could probably get away with using clones). Last way would be to use clones, each clone having a different player icon.

Whichever setup you choose, the game still needs a way of choosing which player was picked. You could just create the actor right on the mouse button down, but then you don't have a way of determining which player was picked after the event. So, the only way to really store information in a game is a variable. You mentioned arrays, but arrays are useful for storing lots of information. In this case we only want one thing, which player was chosen. That can be stored in a single variable, where different values represent different players.

So now that we know we want to use a single variable to determine which actor was picked, we need a way of organizing which players have what value (character a=0, character b=1, character c=2, ...). The best method for this depends on our solution we use for displaying the icons. I suggest using clones, with different animations for each icon. Since each clone has a different animation (and each animation has a different animindex), we can use that as a way of categorizing the characters. More specifically, we can set the player variable equal to the animindex of the icon we click.

When you decide on the character (set the variable), start the game, and create the character type represented by the variable.

Re: Character select...

PostPosted: Mon Oct 15, 2012 12:21 am
by Goomba
OK a couple questions though... How would I set the variable to the icon? would I put each icon in a variable of it's own and do it that way?

Re: Character select...

PostPosted: Tue Oct 16, 2012 12:04 am
by skydereign
Goomba wrote:How would I set the variable to the icon? would I put each icon in a variable of it's own and do it that way?

skydereign wrote:I suggest using clones, with different animations for each icon. Since each clone has a different animation (and each animation has a different animindex)

animindex is an actor variable that signifies what animation the current actor has. So your clones having unique icon images means they each have a unique animindex. Simply put, variable=animindex on mouse button down.

Re: Character select...

PostPosted: Thu Oct 25, 2012 7:10 pm
by Goomba
ohhh... I get it now if each clone has a different image they will have different animindexes, and I can set the variables to them and when they are clicked they will create the specified actor, right? that makes sense... Thanx :D