Hi there. Let see how many try you will need !!
Gantry Crane
// Project: Gantry Crane : Created: 2019-02-08
SetWindowSize( 1024, 768, 0 ) :SetVirtualResolution( 1024, 768 ) :SetSyncRate( 30, 0 ):setcameraposition(1,-10,-18,-70)
createobjectbox(1,40,1,3) :createobjectbox(2,3,2,4):createobjectbox(3,1,30,4):setobjectposition(3,-18,-16,0):SetCameraLookAt(1,0,-15,0,0)
cloneobject(4,3):setobjectposition(4,18,-16,0):createobjectbox(5,1.5,1.2,70):setobjectposition(5,-18,-1,0):cloneobject(6,5)
setobjectposition(6,18,-1,0):createobjectcylinder(7,2,1,10):setobjectposition(7,0,-1,0):fixobjectpivot(7):createobjectcone(8,2,2,10)
setobjectposition(8,0,-2,0):fixobjectpivot(8):createobjectbox(9,200,1,200):setobjectposition(9,0,-30,0):createobjectbox(10,2,5,5)
setobjectposition(10,-18,-30,0):setobjectrotation(10,45,0,0):cloneobject(11,10):setobjectposition(11,18,-30,0)
for i= 3 to 6:setobjectcolor(i,100,40,30,0):next:setobjectcolor(9,90,90,90,0):for i= 10 to 11:setobjectcolor(i,100,40,30,0):next
for i= 1 to 11 :SetObjectCastShadow( i, 1 ):next:shadowMode = 3 :SetShadowMappingMode( shadowMode ):SetShadowSmoothing( 1 )
SetShadowMapSize( 1024, 1024 ) :SetShadowRange( -1 ) :SetShadowBias( 0.0012 ) :dx# = 1.371 :dy# = -1.7428 :dz# = 1.1571
SetSunDirection( dx#, dy#, dz# ):createobjectsphere(1000,1000,8,8):SetObjectColorEmissive(1000,0,0,255):SetObjectCullMode(1000,0)
setobjectcolor(7,60,60,60,0):setobjectcolor(8,22,40,20,0): for i = 1 to 2 :setobjectcolor(i,140,140,0,0):next
createobjectbox(12,4,8,8):setobjectposition(12,21,-26,0):setobjectcolor(12,150,150,20,0):createobjectcylinder(13,0.5,10,8)
setobjectrotation(13,0,0,90):fixobjectpivot(13):cloneobject(14,13):setobjectposition(13,21,-23,0):setobjectcolor(13,60,60,60,0)
setobjectrotation(14,0,90,0):fixobjectpivot(14):setobjectscale(14,0.3,0.3,0.3):setobjectcolor(14,90,90,90,0):createobjectbox(15,3,2,3)
setobjectcolor(15,0,255,0,0):setobjectposition(15,-15+random(0,30),-29,-30+random(0,60)):SetObjectCastShadow( 15, 1 ):tr=1
do
if sc#<1:if ( GetRawKeyState( 38 ) ) then z#=z#+0.4 : if ( GetRawKeyState( 40 ) ) then z#=z#-0.4 :if ( GetRawKeyState( 37 ) ) then x#=x#-0.4
if ( GetRawKeyState( 39 ) ) then x#=x#+0.4 :endif
if z#<-32 then z#=-32 :if z#>32 then z#=32 : if x#<-15 then x#=-15:if x#>15 then x#=15 :if sc#>13 then sc#=13
if sc#=13 : if dis#>4.8 : print(" TRY AGAIN") :setobjectposition(15,-15+random(0,30),-29,-32+random(0,64))
sync()
sc#=0
sleep(1000)
sc#=0
tr=tr+1
endif
endif
if ( GetRawKeyState( 32 ) )then sc#=sc#+0.1
setobjectscale(7,1,1+sc#,1) :setobjectposition(7,x#,0,z#):setobjectposition(8,x#,-sc#*2,z#)
setobjectposition(1,0,0,z#) :setobjectposition(2,x#,0,z#):setobjectrotation(13,z#*10,0,0)
setobjectrotation(14,0,0,-x#*20): setobjectposition(14,x#,1,z#)
lx#=getobjectx(15):ly#=getobjecty(15):lz#=getobjectz(15):obx#=getobjectx(8):oby#=getobjecty(8):obz#=getobjectz(8)
print("Use cursor to move crane")
print("Space to take")
print("Try "+str(tr))
dis#=distance#(lx#,ly#,lz#,obx#,oby#,obz#)
if dis#<5 then print(" YOU WIN")
Sync()
loop
function distance#(x1#,y1#,z1#,x2#,y2#,z2#)
value#=sqrt(((x2#-(x1#))^2)+((y2#-(y1#))^2)+((z2#-(z1#))^2))
ENDFUNCTION value#
I'm not a grumpy grandpa