Multiplyer with two projectiles

Hi! Does anyone have a suggestion how to solve this:

Two players (on one meowbit each with cable). They each have a player that shoots projectiles on each other. If one player hits the other it should gain 1 point and the other player should loose one life, and vice versa. Problem comes to the projectile as the code below doesn’t work… (I tried to call them projectile and projectile 2). Help!

Ok, answering myself… just saw there’s a new extension for this https://github.com/distintiva/pxt-real-multiplayer. Guess that’s what I needed :slight_smile:

The issue here is that both of the projectile sprites you create are of kind Projectile, so the second overlap is the only one that would occur (and would occur immediately whenever player2 fires).

To change this, you can use the set mySprite kind to Player block, which is right below the overlap events in the toolbox:

this will change the kind of the projectile, so you would want to put it in the on player 2 a button pressed event after the create projectile block, so that it immediately changes the kind of that sprite.

Oh, great, I’ll try that! Thank you

1 Like

Tested it, and now it works like I wanted! Thanks again

1 Like