ScratchData LogoScratchData
Back to gtoal's profile

Racetrack POC (Polygon offsetting test)

GTgtoal•Created January 12, 2019
Racetrack POC (Polygon offsetting test)
26
15
523 views
View on Scratch

Instructions

I was exploring the logic behind a racing game for the Vectrex, and wanted to create tracks automatically. That means creating a single line first which is the inner kerb of the track, then polygon offsetting to create the outer kerb of the track. Bumping into the walls should be detectable by the 'distance of a point from a line' algorithm from the mid-point line of the track.

Description

High school maths, but I confess it took me a couple of hours to get it right. Track will scroll - so data structure is a cyclic array containing the track, and it will be drawn both forwards and backwards from where the player is, to simplify clipping.

Project Details

Project ID279175855
CreatedJanuary 12, 2019
Last ModifiedJanuary 17, 2019
SharedJanuary 13, 2019
Visibilityvisible
CommentsAllowed