How to make a two player game.

  • Hi,

    I keep wondering if making a two player game with "construct" is possible ?

    I've tried some construct features but if someone could save me sometime and could tell me the way to do it, i'll really appreciate it.

    I've tried the "search section", but I didn't find any good result.

    Another question : If making a two player is possible, and taking I have two object as "player 1" and "player 2", is it possible to make the first object face automaticaly the second object ?

    I hope that my queston is well wrighten, if it isn't make me know, and I'll re wright it. Thanks in advance.

    And sorry for my bad english, i'm not that good at it.

  • what kind of game you want? Platform as Super Mario? Fighting game player vs. player or 2 players online.

    You speak spanish?

  • Hi,

    I can't speak spanish sorry...

    I want to make a fighting game player vs player, all I need is to know if it's possible for a second player to control another sprite.

  • I can't read your example, it said to me I'm not running the latest construct version ( i'm under 90 and it said to me yours is 91 or newer )

  • Yes, sorry, I'm using the beta version, has some interesting features, but it is a beta release.

    You use the latest stable version. Unfortunately I can not save the example in the previous version. But you can install the beta version. I recommend you try the new features, adds and changes.

    http://www.scirra.com/construct2/releases/r91

  • Yes it's possible, and there are several different ways to go about doing this. Example:

    Keyboard ('Down Arrow Pressed'): Add 500*dt to Sprite1.Y

    Keyboard ('Up Arrow Pressed'): Add -500*dt to Sprite1.Y

    Keyboard ('Left Arrow Pressed'): Add -500*dt to Sprite1.X

    Keyboard ('Right Arrow Pressed'): Add 500*dt to Sprite1.X

    Keyboard ('S Pressed'): Add 500*dt to Sprite2.Y

    Keyboard ('W Pressed'): Add -500*dt to Sprite2.Y

    Keyboard ('A Pressed'): Add -500*dt to Sprite2.X

    Keyboard ('D Pressed'): Add 500*dt to Sprite2.X

    There, Player 1 can control Sprite1 using the Up, Down, Left, Right arrow keys and Player 2 can control Sprite2 with WSAD.

  • Thanks for your answer Dalal.

    I've tried your way, but i'm blocked after the condition -> "Keyboard" -> On ******* pressed. I click on add an action and then ?

    I'm not that used to some event's expression of yours. It's always what block me in making event.

  • I put together an example using the default behaviors. You can use Simulate control to control multiple character just remember to shut off the Default Controls option.

    2 player example

    WASD moves the first character, and the arrow keys move the second.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wooooah really thank you mate, that help me a lot. Simple and practical.

    If that bother you too much, could you please make the same example for my second problem :

    Make the first sprite, automatically face the second sprite.

    Since I want to make a 2d fighting game, that would help me, really.

  • The game pad plugin might work. If I'm not mistaken it can handle multiple pads. I think it just assigns a number to the pad such as pad0 and pad1. I'm not sure how you would handle split screen though. So pad0 would be assigned to sprite0 movement and pad1 would be assigned to sprite2 movement commands. Ie if pad1 left axis >= 50 then simulate control for sprite2 left,right,up,down accordingly. Doing that for both should allow movement of both but again keeping them both visible on the screen might be a bit more of a challenge on bigger layouts.

  • To make them both face each other you can just use the Sprite.X compared against Sprite2.X so when Sprite.X is Greater Than Sprite2.X then you mirror the sprites. Then you need an else to disabled the mirror.

    Two player look example

  • Really sandcrawler, thank you. I've searching how to do it for hours.

    You're the stuff. Thanks to the other too.

  • anybody tried with a second mouse and / or controller?

  • I think both Sandcrawler's and andorade's example uncovered a bug

    Issue:

    When I press the W&D key will while also pressing the UP&Left Arrow both pieces switch places as expected. But..

    If I immediately Press the W&A and also the UP&RIGHT arrow the pieces stay in the same place or move erratically.

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