playMaker

Author Topic: How to control 2 players?  (Read 2241 times)

DaPixelWizard

  • Playmaker Newbie
  • *
  • Posts: 7
How to control 2 players?
« on: May 04, 2015, 11:07:33 PM »
I'm working on a 2d game that has multiple player characters in the scene at once. The first character I made the controls for using rigidbody. If the second character is controlled in the same way, is there a way to just copy everything from the first character (but with a different sprite), and toggle between which one is being controlled? Or does the second one need it's own variables and whatnot?
Currently, the second character has it's own unique variables, but is controlled by different keys. I'd be fine with that, in fact I'd prefer it, except for the fact that I can't get him to move on the horizontal axis. His jump works, but I can't figure out why he won't move back and forth. I copied everything from the first guy who works fine, to this guy, and added/changed all of the states and variables to be unique to him, but still nothing. Any help for these problems is greatly appreciated. Since I'm a total programming noob, I had to follow a tutorial. Here is the tutorial I followed if it helps someone figure this out for me.
« Last Edit: May 06, 2015, 10:20:26 AM by DaPixelWizard »

redikann

  • Full Member
  • ***
  • Posts: 174
Re: How to control 2 players?
« Reply #1 on: May 06, 2015, 10:56:26 AM »
Sounds like maybe you need to define another virtual axis in the Input Editor. Select the First 'Horizontal' axis (should be a-d keys) and CTRL D to copy it and then selct the keys you want for your new Horizontal controls and rename it. In playmaker be sure to use your new name axis input for your character.

DaPixelWizard

  • Playmaker Newbie
  • *
  • Posts: 7
Re: How to control 2 players?
« Reply #2 on: May 06, 2015, 11:02:51 PM »
Sounds like maybe you need to define another virtual axis in the Input Editor. Select the First 'Horizontal' axis (should be a-d keys) and CTRL D to copy it and then selct the keys you want for your new Horizontal controls and rename it. In playmaker be sure to use your new name axis input for your character.

Oh my goodness, this totally worked. Thanks a lot. I thought I had done this, but in a slightly different way. I guess whatever I did before was wrong though. Anyway, thanks again.