Introduction: 2d Rocket Landing Sim

You will need to arrive at a background, draw rockets, and an indicator to begin (of course you'll need an net connection to use scratch) if you just want to play the feigning/ gamey, click hither, or function to https://scrub.mit.edu/projects/432509470/

Step 1: Natural philosophy Engine

Rocket simulators cannot exist without physics simulation, and then you wish need totally of the variables as follows:

  1. Vh or VelocityHorizontal as shown in the example
  2. Vv or VelocityVertical as shown
  3. EnginePower, to indicate thrust generated by the rocket engine
  4. EngineAngle, for steering by gimbals
  5. total velocity, for index number and touchdown conditions
  6. unconnected, for reasons we will put on in the side by side step

Aft creating the variables, go to "motion" pill, and put down the blocks [change x by()] and [change y by()]

Place your Vv in the [variety y by()] and Vh in the [change x past()] and put the whole thing in a loop.

To hyperkinetic syndrome gravity, fair-and-square add a [modification Vh past (-1)] to the loop.

To add some semblance of drag, add the following block to the loop:

[set Vh to (0.99*Vh)]

[set Vv to (0.999*Vv)]

Oh boy now it's time for the "engines"

Since this will be controlled away gimbals and direction pointing, we need something that testament allow the rocket to travel in the direction it is pointing at. every bit the locomotive rotation testament have some effect on the direction of thrust, the engine angle will contribute to the total thrust direction slightly so add that, and ask the computer to do a bit of trig and voila, the railway locomotive output is done.

Step 2: Game Mechanics

As a "game" this must have controls, a profits condition, and close to way for the game to end.

For the controls, all that needs to be done is to connect keys to some of the variables we set earlier

Attribute two keys to the locomotive engine direction and one to enginepower, As shown above

For the win condition, wont one specific color or y level to make up the priming coat, and here I put a large parcel of the map as unlandable area. as you see here, thither is use of the "exploded" variable, IT prevents the costume setter from switching back to an unexploded from when plosion is triggered. the parameters are being more or little perfectly upright, and having a very low velocity. now afterward the landing, the rocket is situated at a positive y plane to forbid vagrant rocket, and everything is set to 0.

For opening conditions, set it to a reasonable angle at a reasonable place, or get in random, IT's your choice

Step 3: Indicators

and in the end just to go far playable for more people, i added indicators, and you should too, visual indicators are easier to spot, and the code is displayed above.

Be the First of all to Divvy up

Recommendations

  • Anything Goes Contest 2022

    Anything Goes Contest 2022