Choose Characters

0 favourites
  • 6 posts
From the Asset Store
120 Epic Fire FX Animations + 2 Bonus Characters. Contains 3000+ frames and a lot of Pixel Art Sprites
  • I have a game with 5 characters and I wanna put the play to choice in the begin of game.

    Something like:

    Char 1 -> <- Char 2 -> <- Char 3 -> <- Char 4 -> <- Char 5

    The arrows is like in keyboard. I click the arrow, and change the char in the middle of screen.

    My question is, how I do that. When I put click "->" happen Char 1 to Char 5

  • Make a value and call it something like "CharSelect" or so. Have its initial value be somewhere between 1 and 5.

    When the left arrow key is pressed subtract 1 from the value, and when right is pressed add 1 to it.

    To make it so you can't go below or over 1-5 add events that check if the value is over 5 or below 1. So when the value goes below 1 you set the number to 1 (or five if you want the menu to be cyclical), and vice versa.

    So when CharSelect is equal to 1, then you have Char 1 selected, and so on. Pretty basic but useful way of making your own menus.

  • What inkbot said

    also to make it a single action to set and keep it between 1 and 5

    set charselect=clamp(charselect+1,1,5)      

    to go right

    To go left replace the +1 with -1

    To make it cyclical with a single action, make it 0 thru 4 instead of 1 thru 5

    and use charselect=((charselect+5)+1)%4

    For right movement and replace (charselect+5)+1 with (charselect+5)-1 for left movement

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh! Thank you lucid and inkBot

    But other question, have autmatically way to do better that, because, I can put some itens to choose, like 20 (Swords, shields) and other scenes to choose in this same way.

    20 pills

    10 Scenes

    25 Itens

    5 Chars

    The lucid method sounds cool to that. I will try

  • I'm without time now to write you a tutorial of how I did my menus, but I can tell you to use something like a matrix.

    So, I did an cursor for the object selection, and slots, where the movement of the cursor is set to move in grid, fixing the smaller and the bigger X and Y of this cursor, when it's overlaping the object in that menu, it's selected.

    Creating the object inside the menu and deleting or rearranging it is pretty easy, you just need to setup a variable for that object in the instant when the player pickup it, and if already exist, just add more for his amount.

    Complex menus can be made, using your imagination, like rearranging the objecting on the grid, you can, when swapping one with other, just set his slot ID with the same conditional and 2 actions, but while changing, you need to setup a new variable for the second object. For example, if you wanna change the object number 2 with the 3, set the object 3 slot to be 3_old, change the 2 to be 3 and the 3_old to be 2, etc.. Just a logic ^^

    (check the mouse to meet the requirements, if you're using the mouse cursor, for rearrange the grid)

    When the selecting cursor is overlapping the character "pick_character.ID"

    When the selecting cursor is not overlapping character "pick_character.ID -1"

    When the selecting cursor is not overlapping character "pick_character.ID +1"

    etc. Treat each exception here, because you don't want the player grabbing more than once each time.

    (set what will happen)

    Set temp_slot_free to (character.sprite.ID.X, character.sprite.ID.Y)

    > Set character.sprite.ID X,Y to (cursor.X, cursor.Y);

    By this way, you'll need now check where the cursor is when the player release the mouse button, setting this position inside a grid and changing the object.X and Y under it to match the temp_slot_free coord. if this slot is not free, if it's free, just set the new position to the object grabbed by the mouse.

    What I'm doing will be useful for many people here, I pretend to make an character strip organizer with alignment (top, bottom, middle, left and right, plus the interaction with each other and by coord. too), rotation, pivot point, slot management (rearranging), etc, so, you can setup very fast and easy that animation what is giving you pain, because one frame is not aligned perfectly ^^

    Sorry if I didn't helped too much, but the code to make a "good" selection menu need many logic and exception treatments, nothing hard, but many work need to be done, it's something what you can do, I believe.

  • I try do do that. But I don't get the whole idea.

    If you can make a little example... I am geting lost =(

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)