How do I ... play selected player?

0 favourites
  • 9 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi Community,

    Trying to get my head arount this one. Let's say, on the menu, you have a choice of 3 characters (e.g. Elf, Knight, Wizard)... in the PlayLayout, I want the same experience for the player (ie. map, enermies) but the character must be as selected from the menu... which they will have their own attributes.

    I can only think... on PlayLayout, Sprite with 8Direction. I want to PIN another sprite with (say Wizard) on to the sprite with movement.

    Would you use an Array for this?

    Thanks,

    Roberto

  • You can do this with a global variable for char. You can create your player object and set animations based on selected character with variables. Say char=1, 2 or 3. If you have different attacks you limit it by char=1, you do elf attacks, char=2 you do knight attacks etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks plinkie,

    on my MenuLayout, I set Global Num 'player' = 0

    If Mouse click on (Elf) then set 'player' = 1

    If Mouse click on (Wiz) then set 'player' = 2

    Click BUTTON to goto PlayLayout

    [PlayLayout]

    Include MenuLayout

    On Start of Layout

    System player = 1 then PIN Elf to puppet sprite (with 8Dir)

    > System player = 2 then PIN Wiz to puppet sprite (with 8Dir)

    but this ain't happening..... the var is 0

    Not sure why :(

  • Do you mean its set to 0 initially or you set it with events?

    Does it change correctly when you select a character then change to 0 in the new layout?

  • I setup an Every tick with Set TEXT to 'player' and this does set it on MenuLayout, but as soon as I'm on PlayLayout, which also has same TEXT value > is always 0

  • I've just done a quick test on a new project and that works, so there must be something wrong with my game :(

  • This is just going to be a lot of guessing where it's gone wrong. Do you have set text event for both layouts or only the menu layout? Are both layouts linked to the same event sheet? Check in debug mode if the variable is correct but the text is showing 0.

  • I do this all the time, so if I undrstand correctly what you want, this will work.

    Keep all animations in a single sprite and pin it to whatever....

    Add a number after each of your animations. Let;s say Wizard is 0 and has 3 animations, walk, run, jump.

    Add 0 so they are renamed walk0, run0, jump0. Elf animations will be walk1, run1, jump1

    Then use a global variable called selected. When you select the wizard set selected to 0 and in your events target animations like this: "walk"&selected , "run"&selected and so on

    If a different character is selected then variable would be set to 1, or 2, and do the same thing, adding those numbers to each animation's name.

    So that sprite will be pinned to your puppet sprite and the right animation will be playing depending on selected variable

  • Thanks plinkie & BadMario for all your help ;)

    Roberto

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