Easier way to do this for co-op

Hello! I’m making a top-down shoot em up co-op game and I was wondering if there was a easier and less messier way to do what I’m trying to do:

Do I need to copy and paste ALL of this and do it for another player? Or is there a less messier way to do this?

For some you need to have very similar code repeated, but others you can do in an easier way.

The area marked 1 will need to be repeated. The key presses are unique to each player, and need to be dealt with individually.

The area marked 2 can be generalised and doesn’t need to be repeated. Put all the player objects into an object group (P_Redpshyo and whatever other ones), and then replace all instances of P_Redpshyo in section2 with the object group name.

1 Like

Hi! Thanks for trying to help but I’m having a hard time understanding this quote.

Edit: nvm, I understand now… I’ll try it.