JIT
RTS game 8bit
RTS game 8bit.

Okay, let's start building a very basic foundation for an 8-bit style RTS game using HTML, CSS, and JavaScript. We'll begin with setting up the canvas and drawing a single static unit.

This sets up the basic HTML page with a canvas, styles it slightly, and includes a JavaScript file that draws a single yellow square representing a unit on the canvas. The imageSmoothingEnabled = false helps achieve a sharper, pixelated look.

Updated files
v1
improve all

Okay, let's improve the RTS foundation. We'll add:

  1. Unit Selection: Click on a unit to select it.
  2. Movement: Click on the map to move the selected unit to that location (basic, instant movement for now).
  3. Multiple Units: Start with a couple of units.
  4. Visual Grid: Draw a faint grid on the map.
  5. Selection Indicator: Show which unit is selected.

Now you can:

  • See a grid on the map.
  • Click on one of the colored squares (units) to select it (a white border will appear).
  • Click elsewhere on the map to instantly move the selected unit to that grid location.
  • Clicking on empty ground deselects any unit.
Updated files
v2