From Dinosaurs to Aliens

Within Replit, you can see the game T-Rex Runner, a copy of a game hosted in Chrome. To play T-Rex Runner:

  1. Click inside the frame on the right containing the game.
  2. Press the space bar to begin the game. Your dinosaur starts running. It can't stop, but it can jump over obstacles.
  3. Press the Up Arrow (⬆) key to jump. The further you run, the higher your score.

Your first task is to change the game's setting from prehistoric Earth to space, complete with aliens and an astronaut. You can do this by replacing the game's graphics.

T-Rex Runner is a sprite-based browser game. All of the graphics ("sprites"), including the dinosaur, obstacles, and background, are contained in one image file called ./images/200-percent/200-sprite.png:

T-Rex sprite

The image file you're going to use for your version of the game is called ./images/200-percent/200-sprite-space.png:

Toggle sprite

As you can see, we've added some color and aliens.

This first lesson includes the following:

  1. Add the LaunchDarkly SDK for Javascript to the game, so that it can use feature flags.
  2. Create a "Space Mode" feature flag in LaunchDarkly.
  3. Modify the game code so that toggling the flag changes the game's graphics.

In the next step, you'll look at the game more closely.