03-06-2024, 05:01 PM
Hehe, some quick code, but I'm not sure it will help much, it's just a visual thing:
Code:
#win32
set window "nah ...", 320, 240, false, 2
set redraw off
road = []
for z = 0 to 200 road[z] = sin(z*0.05)*6
playerz = 0.0
playerx = 0
p = dim(8)
while not keydown(KEY_ESCAPE, true)
playerz = playerz + 0.075
if keydown(KEY_LEFT) playerx = playerx - 0.1
if keydown(KEY_RIGHT) playerx = playerx + 0.1
set color 64, 64, 128
cls
set color 200, 128, 64
draw rect 0, 125, 320, 120, true
set color 255, 255, 255
for i = int(playerz) + 20 to int(playerz)
if i < sizeof(road) - 2
z = i + 1 - playerz + 1.1
x0l = 160 + 200*(road[i + 1] - 1 - playerx)/z
x0r = 160 + 200*(road[i + 1] + 1 - playerx)/z
y0 = 120 + 130/z
z = i - playerz + 1.1
x1l = 160 + 200*(road[i] - 1 - playerx)/z
x1r = 160 + 200*(road[i] + 1 - playerx)/z
y1 = 120 + 130/z
if i%2 = 0 set color 128, 128, 128
else set color 96, 96, 96
p[0] = x0l; p[1] = y0; p[2] = x0r; p[3] = y0
p[4] = x1r; p[5] = y1; p[6] = x1l; p[7] = y1
draw poly p, true
endif
next
redraw
fwait 60
wend