Using 'When key is pressed' and 'collisions'

A student has created a scene whereas when one key is pressed a rocket goes up and when another key is pressed, the rocket goes back down to the launchpad. We have been trying to get the rocket to stop when it collides with the launchpad but have been unable to figure out how to do this. Any ideas?
This is the space: CoSpaces Edu :: Flying Rocket

Thank you,
Tech Warriors

1 Like

Hi @TechWarriors,

You have shared a link to the CoSpace Editor which is inaccessible to the public. In order to share your CoSpace with others correctly, you need to press “Share” next to the Help menu in the Editor, select unlimited, make it remixable (so forum users can help you debug), and copy the URL/Internet address of the CoSpace.

Geoff @ TechLeap

1 Like

I have updated the sharing link. Here it is: CoSpaces Edu :: Flying Rocket

Thank you!

1 Like

You could:

  1. Use the push forward with velocity 1 Physics CoBlock (turn on Settings > Advanced)
  2. Turn off set static in the Rocket’s Object Inspector (under Physics), and
  3. Remove the when X pressed event.

Your Z key would provide the rocket thrust, and gravity would do the rest.

Also, if you attach the fire to the rocket by dragging it onto the rocket in the Scene Inspector, you can remove the “move fire” code.

Move CoBlocks don’t respect Physics.

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

Thank you that worked!

1 Like