How do I go about choosing characters with diferent movesets

0 favourites
  • 4 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • Hey guys, I'm trying to think of how I would go about doing this. Maybe store variables labeled for each move? All of the characters animations are named the same ex: Idle, Run, Jump etc. Has anyone done this before?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Look into Families. Create a Family called "Player", and then set the animation of "Player" to Idle, Run, Jump etc. You might need a "playerNumber" variable on the family so you can assign different controls to each player.

  • How would I go about assigning different controls to each player? I just figured out the choosing character part thanks to you

  • Glad you were able to figure that out!

    I think a reasonable approach would be to have an instance variable for each action. Assuming a two-button game where you can move left and right, you might add the instance variables "leftButton" and "rightButton" to your "Player" family's instance variables. These variables will store the key codes for each action.

    Continuing this example, you could set P1's leftButton to 37 (which is the left arrow key) and the rightButton to 39 (the right arrow key). You could set P2's leftButton to 65 (which is 'A') and the rightButton to 68 (which is 'D'). Once each player on screen has a different set of controls, the following event logic will work to control the players:

    For each "Player"
       Key Code Player.leftButton is down   | Move "Player" Left
       Key Code Player.rightButton is down  | Move "Player" right[/code:2xcz1gqh]
    
    Basically it's asking each player what their button for a particular action is, then checking to see if that button is pressed. if it is, then do what needs to be done to that Player to execute that action e.g setting animations, moving the player, etc. In this manner, you can assign all of your controls.
    
    That's the basic approach. There could be a better one, but this might give you some ideas.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)