How do I streamline my platforming code?

Get help using Construct 2

Post » Fri Mar 21, 2014 3:49 pm

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!
You do not have the required permissions to view the files attached to this post.
B
3
Posts: 1
Reputation: 177

Return to How do I....?

Who is online

Users browsing this forum: 7Winter, HellMax, Lordshiva1948, Matei511, Yahoo [Bot] and 57 guests