My version of a Beizer in AGK
// Project: sprite mover
// Created: 2020-03-13
// show all errors
SetErrorMode(2)
#constant screenwidth=1024
#constant screenheight= 768
// set window properties
SetWindowTitle( "sprite mover" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
type _Points
x#
y#
endtype
global points as _Points[]
global point as _Points
global spr as integer[]
// Beizer
// create 3 points that is statically positioned on screen
p1x#=10
p1y#=10
p2x#=screenwidth/2
p2y#=screenheight
p3x#=screenwidth-10
p3y#=10
createBeizer(4,p1x#,p1y#,p2x#,p2y#,p3x#,p3y#,0)
spr.insert(CreateSprite(0))
currentpoint=0
c=MakeColor(255,255,255)
do
print(points.length)
for a=0 to points.length-2
DrawLine(points[a].x#,points[a].y#,points[a+1].x#,points[a+1].y#,c,c)
DrawLine(points[a+1].x#,points[a+1].y#,points[a+2].x#,points[a+2].y#,c,c)
next
SetSpritePosition(spr[0],points[currentpoint].x#, points[currentpoint].y#)
inc currentpoint
if currentpoint>points.length then currentpoint=0
Print( ScreenFPS() )
Sync()
sleep(100)
loop
function createBeizer(n, p1x#,p1y#, p2x#, p2y#, p3x#, p3y#,b)
// insert points
point.x# = p1x#
point.y# = p1y#
points.insert(point)
/* point.x# = p2x#
point.y# = p2y#
points.insert(point)
point.x# = p3x#
point.y# = p3y#
points.insert(point)
*/
//calculate new step
if n>0
p12x# = (p1x# + p2x#) / 2.0
p12y# = (p1y# + p2y#) / 2.0
p23x# = (p2x# + p3x#) / 2.0
p23y# = (p2y# + p3y#) / 2.0
p123x# = (p12x# + p23x#) / 2.0
p123y# = (p12y# + p23y#) / 2.0
createBeizer(n-1,p1x#,p1y#,p12x#,p12y#,p123x#,p123y#,b+3)
createBeizer(n-1,p123x#,p123y#,p23x#,p23y#,p3x#,p3y#,b+3)
endif
endfunction
Its rubbish i know
Increase the N in the function from 4 to what ever for detail
Line 42