Kart race ; coding bugs

Hi all,
I’m working on a race but i have some troubles with my coding :
1-i want that a car “take” a coin n°1, the coin n°1 disappear and an other one arrives. At the end, if a car have collect 6 coins, the player wins the game. I make coblocks but the coin n°1 never disappear ^^
2-when my cars hurt a red wall, it didn’t stop, it goes trough… I try to put “physic” but all my tries were failures… (first time i work with “physic items”)
Do you have some tips for help me. THANKS A LOT

it works when I rotate the first coin.

Hi @dthomas80,

There’s a couple of issues with your code:

  1. You don’t need to use run parallel with events - they are processed at the start of the game, and then they are forever waiting for that event to occur
  2. You can’t use collision events with Groups
  3. You can’t use the same object as the 1st parameter for multiple collision events - subsequent events will override each other.
  4. Move CoBlocks ignore Physics

The solution for the coins is to use the advanced collision event block which puts the item you’ve collided with into a variable, which you can then check with if/then/else statements to see if it’s an item you want. See this remix:

This is also a potential solution for your wall issue - if you hit a wall, you could move the player off the wall; however, possibly a better solution is to use Physics blocks for movement. I haven’t done that in the above CoSpace, as it requires a lot of tweaking to get it right.

Hope that helps! Let me know if you have any further questions about this. If this solves your problem, please mark this post as the Solution.

Many thanks,
Geoff @ TechLeap

1 Like

@Elly : thanks for this solution, didn’t think that just rotate could be a difference :wink:
@techleapnz : thanks for your help, i see that and come back to you :wink: