How do I streamline my platforming code?

0 favourites
  • 1 posts
From the Asset Store
Two levels with two sistem Wave. with Source-code (.c3p) + HTML5 Exported.
  • Hi all!

    I'm wondering if there is a way to streamline some platforming code I have. I'm prototyping a 2-player battle type game, and I feel like the code is a bit more bloated than I would like.

    If you'll look at my attached .capx (I included all my silly code comments as is, so have a laugh!), the only way I could figure out platforming movement for 2 players is by coding each player separately. I also implemented a mid-air dash function, but I had to duplicate the code for the second player. I'm basically finding it quite the headache to implement functionality for one player, and then have to copy and paste it every single time for the other player.

    What I'm wondering is...

    a) Is there a way to just create one function that will handle dashing for both players? Is there a way to pass off values to a single function and just have it handle a dash for either player when they trigger it?

    b) Can I create movement code that works for both players? Rather than having to copy and paste it for the second player? (WASD for player 1, numpad 8456 for player 2).

    Thanks so much for your time!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)