ikbensiep / lofigame

A 2D game without canvas, only html vibes. SVG is used not only for artwork but to annotate as much world/level data as possible, simply by drawing shapes accoring to a few rules. Exploring wether it's worthwile to make it into an open source 2d world game engine.
https://ikbensiep.github.io/lofigame/
GNU General Public License v3.0
1 stars 0 forks source link

Add lap timing with sectors #36

Closed ikbensiep closed 5 months ago

ikbensiep commented 1 year ago

This could be done by adding separate sector <path>s or by repurposing the waypoints found in path#racetrack.

Discuss.

ikbensiep commented 9 months ago

I'm thinking of calculating the 3 sectors purely by dividing the waypoints the code finds along the racetrack path:

sector 1 starts at waypoints[0] and ends at waypoints[waypoints.length / 3] sector 2 starts at waypoints[(waypoints.length / 3)] and ends at waypoints[waypoints.length - (waypoints.length / 3)] sector 3 starts at waypoints[waypoints.length - (waypoints.length / 3)] and ends atwaypoints[0]`.

with some appropriate Math.floor() ing here and there.

Additionally, by keeping track of waypoints we know in which sector the player is in currently so that when they go off track we can throw yellow flags along with the sector the yellow flag is shown in.