Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 926 Bytes

README.md

File metadata and controls

39 lines (30 loc) · 926 Bytes

lander

A 2D simulation game where you program rocket boosters to land.

Mar-10-2023 07-06-40

Develop

  1. Install dependencies npm i
  2. Start the dev server npm start
  3. Navigate to http://localhost:3000

Play

  1. Write code
  2. Click RUN

Example:

setInterval(() => {
  if (falcon9.angle > 0.1 && falcon9.rotationalMomentum > -0.15) {
    falcon9.fireLeftThruster = true;
    falcon9.fireRightThruster = false;
  } else if (falcon9.angle < -0.1 && falcon9.rotationalMomentum < 0.15) {
    falcon9.fireLeftThruster = false;
    falcon9.fireRightThruster = true;
  } else {
    falcon9.fireLeftThruster = false;
    falcon9.fireRightThruster = false;
  }

  if ((falcon9.velocity.y > 2) || (falcon9.velocity.y > 0.5 && falcon9.altitude < 125)) {
    falcon9.fireBoosterEngine = true;
  } else {
    falcon9.fireBoosterEngine = false;
  }
}, 10);