Hi there . I'm always late
. Here's another of my old codes . I made this some time ago trying to maka a caterpillar moving . We could make a 20 lines challenge now that the forum has more activity
// Project: watch
// Created: 2018-12-01
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "watch" )
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
`
x as float
y as float
z as float
l as float
r as float
`Making some crowns
`crown(obj , sides , size_x , size_y , size_z , radius , position_x , position_y , posiition_z)
Crown(1001,10,7,0.6,0.6,7,0,0,0)
crown(1002,20,8,0.5,1,6,10,1,0)
crown(1003,53,14,8,2,40,0,0,0)
crown(1004,6,4,1,1,2,-15,0,0)
crown(1005,6,4,2,1,1,-13,-1,-5)
crown(1006,20,12,0.5,0.9,9.5,-10,-5,0)
crown(1010,12,1,1,5,38,0,1,0)
`second-hand
createobjectcone(1007,30,5,10)
setobjectcolor(1007,255,0,0,0)
setobjectrotation(1007,-90,0,0)
FixObjectPivot(1007)
setobjectposition(1007,0,2,-13)
SetObjectScale(1007,1,0.1,1.7)
`second-hand pivot
createobjectbox(1008,0,0,0)
FixObjectToObject(1007,1008)
`watch glass
createobjectcone(1011,1,80,30)
SetObjectPosition(1011,0,4,0)
SetObjectColor(1011,100,255,100,0)
SetObjectTransparency(1011,1)
SetObjectAlpha(1011,80)
`our Sky
createobjectcylinder(4000,1000,480,40)
SetObjectCullMode(4000,0)
SetObjectColorEmissive(4000,100,100,255)
`getting number of existing objects that make the crowns
for i= 1 to 800
if GetObjectExists(i) then obj=obj+1
next
for t= obj-11 to obj
SetObjectColor(t,255,255,255,0)
next
setcameraposition(1,-10,80,-100)
SetCameraLookAt(1,0,0,0,0)
do
tn#=tn#+0.5
ct=ct+1
if ct=30
t#=t#+6
ct=0
endif
setobjectrotation(1008,0,t#+180,0)
setobjectrotation(1001,0,tn#,0)
setobjectrotation(1002,0,-tn#,0)
setobjectrotation(1004,0,tn#*4,0)
setobjectrotation(1005,0,-tn#*4.5,0)
setobjectrotation(1006,0,-t#*0.5,0)
Sync()
loop
function Crown(n,L,x,y,z,r,px,py,pz)
`crown(obj , sides , size_x , size_y , size_z , radius , position_x , position_y , posiition_z)
createobjectbox(n,0,0,0)
for i= 1 to 800
if GetObjectExists(i) then inc ob,1
next
`Slightly different colours
dark=random(0,60)
for i= 1 to l
ob=ob+1
rt#=360.0/l
createobjectbox(ob,x,y,z)
setobjectrotation(ob,0,i*rt#,0)
moveobjectlocalz(ob,r)
FixObjectToObject(ob,n)
setobjectposition(n,px,py,pz)
setobjectcolor(ob,200-dark,114-dark,0,0)
next
endfunction
Cheers.
I'm not a grumpy grandpa