encompass-cs-docs/content/pong/draw_paddle/first_run.md

1.2 KiB

title date weight
First Run 2019-05-23T12:21:05-07:00 20

All we have to do now is run our build and run script in the terminal.

> npm run love

Exciting!! Let's see what happens...

pong first run

Oh dear. That paddle is quite small. Bit of a buzzkill really.

const width = 20;
const height = 120;
position_component.x = 40;
position_component.y = 360;

pong second run

Thaaaaaaat's more like it.

Notice how we can just change simple Component values, and the result of the simulation changes. In a larger project we would probably want to define these Component values in a separate file that lives on its own. This is called data-driven design and it is a powerful feature of ECS-like architectures. When we do data-driven design, we can modify the game without even looking at source code - just change some values in a file and the game changes! If we wanted to get really clever, we could probably have an in-game editor that changes these values even while the game is running!

But for such a simple example, leaving this in the load function is probably fine. Let's move on and get this paddle moving.