Hi there . This my first attempt to make a Mr Potato . update coming soon
// Project: Mr Potato
// Created: 2018-12-21
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Mr Potato" )
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
`body
CreateObjectSphere(1,30,15,15)
setobjectcolor(1,63,20,0,0)
`creamos un malla para el objeto 1
mesh = CreateMemblockFromObjectMesh(1,1)
`get vertex quantity
verts= GetMemblockInt( mesh, 0 )
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
if y#>6 then SetMeshMemblockVertexPosition(mesh,i,x#*0.9,y#+y#*1,z#*0.9)
next
SetObjectMeshFromMemblock(1,1,mesh)
setobjectimage(1,1,0)
`--------------------------------------------------------------------------------
`hat
createobjectsphere(2,12,15,15)
setobjectposition(2,0,25.5,0)
setobjectcullmode(2,0)
setobjectcolor(2,0,0,0,0)
setobjectrotation(2,0,0,2)
mesh = CreateMemblockFromObjectMesh(2,1)
`get vertex quantity
verts= GetMemblockInt( mesh, 0 )
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
if y#<0 then SetMeshMemblockVertexPosition(mesh,i,x#*1.5,0,z#*1.5)
if y#<-1 then SetMeshMemblockVertexPosition(mesh,i,x#*1.7,2,z#*1.7)
next
SetObjectMeshFromMemblock(2,1,mesh)
`-------------------------------------------------------------------------------------
`eye
gosub texture
createobjectsphere(3,5,15,15)
setobjectimage(3,1,0)
setobjectrotation(3,-75,0,0)
setobjectscale(3,1,1,1.5)
fixobjectpivot(3)
setobjectposition(3,-2,18,-9)
`--
cloneobject(4,3)
setobjectposition(4,2,18,-9)
`-------------------------------------------------------------------------------------
`shoe
createobjectsphere(5,14,15,15)
setobjectposition(5,-5,-18,-5)
setobjectcolor(5,30,30,250,0)
setobjectscale(5,1,1,2)
mesh = CreateMemblockFromObjectMesh(5,1)
`get vertex quantity
verts= GetMemblockInt( mesh, 0 )
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
if y#<0 then SetMeshMemblockVertexPosition(mesh,i,0,0,0)
if y#<0 then SetMeshMemblockVertexNormal(mesh,i,0,0,-1)
next
SetObjectMeshFromMemblock(5,1,mesh)
cloneobject(6,5)
setobjectposition(6,5,-18,-5)
setobjectrotation(5,0,13,0)
setobjectrotation(6,0,-13,0)
`----------------------------------------------------------------------------------
`ears
createobjectsphere(7,10,15,15)
setobjectscale(7,0.8,1,0.3)
setobjectposition(7,-13,18,-2)
setobjectcolor(7,255,180,255,0)
`---
cloneobject(8,7)
setobjectposition(8,13,18,-2)
setobjectrotation(7,0,0,-25)
setobjectrotation(8,0,0,25)
`-----------------------------------------------------------------------------------
`nose
createobjectsphere(9,5,15,15)
mesh = CreateMemblockFromObjectMesh(9,1)
`get vertex quantity
verts= GetMemblockInt( mesh, 0 )
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
if y#>1 then SetMeshMemblockVertexPosition(mesh,i,x#*0.7,y#*1.5,z#*0.7)
if y#<1 then SetMeshMemblockVertexPosition(mesh,i,x#*1.2,y#*1.5,z#*1.5)
next
SetObjectMeshFromMemblock(9,1,mesh)
setobjectposition(9,0,12,-12)
setobjectcolor(9,255,155,0,0)
`--------------------------------------------------------
`moustach
n=9
for i= 1 to 8
inc n
createobjectsphere(n,5,6,6)
setobjectposition(n,-4+i*0.9,7,-13)
setobjectrotation(n,0,0,-50+i*12)
setobjectscale(n,0.5,1,1)
setobjectcolor(n,0,0,0,0)
next
`---------------------------------------------------------
`right hand
createobjectsphere(18,4,6,10)
setobjectscale(18,1,3,1)
fixobjectpivot(18)
mesh = CreateMemblockFromObjectMesh(18,1)
`get vertex quantity
verts= GetMemblockInt( mesh, 0 )
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
if y#>2 then SetMeshMemblockVertexPosition(mesh,i,(x#*0.7)+5,10,z#*0.7)
if y#<-3 then SetMeshMemblockVertexPosition(mesh,i,(x#*0.5)+5,-15,z#*0.5)
next
SetObjectMeshFromMemblock(18,1,mesh)
setobjectposition(18,-18,12,-7)
setobjectrotation(18,135,0,-20)
fixobjectpivot(18)
`--- left hand
createobjectsphere(19,4,6,10)
setobjectscale(19,1,3,1)
fixobjectpivot(19)
mesh = CreateMemblockFromObjectMesh(19,1)
`get vertex quantity
verts= GetMemblockInt( mesh, 0 )
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
if y#>2 then SetMeshMemblockVertexPosition(mesh,i,(x#*0.7)-5,10,z#*0.7)
if y#<-3 then SetMeshMemblockVertexPosition(mesh,i,(x#*0.5)-5,-15,z#*0.5)
next
SetObjectMeshFromMemblock(19,1,mesh)
setobjectposition(19,18,12,-7)
setobjectrotation(19,135,0,20)
fixobjectpivot(19)
`unifying objects
for i= 2 to 19
fixobjecttoobject(i,1)
next
`our Sky
createobjectsphere(4000,31000,20,20)
SetObjectCullMode(4000,0)
SetObjectColor(4000,100,100,255,0)
SetCameraPosition(1,0,30,-80)
SetCameraLookAt(1,0,0,0,0)
SetCameraRange(1,1,100000)
v=0
do
gosub camara
g=g+2
setobjectrotation(1,g,g,g)
Print( ScreenFPS() )
print(v)
Sync()
loop
texture:
`eyes
wt=makecolor(255,255,255)
drawbox(0,3,30,30,wt,wt,wt,wt,1)
getimage(1,0,0,30,30)
return
camara:
if ( GetRawKeyState( 38 ) ) then MoveCameraLocalZ( 1, 1 ) // cursor up
if ( GetRawKeyState( 40 ) ) then MoveCameraLocalZ( 1, -1 ) // cursor down
if ( GetRawKeyState( 37 ) ) then MoveCameraLocalX( 1, -1 ) // cursor iz
if ( GetRawKeyState( 39 ) ) then MoveCameraLocalX( 1, 1 ) // cursor derecha
if ( GetPointerPressed() )
startx# = GetPointerX()
starty# = GetPointerY()
angx# = GetCameraAngleX(1)
angy# = GetCameraAngleY(1)
pressed = 1
endif
if ( GetPointerState() = 1 )
fDiffX# = (GetPointerX() - startx#)/1.0
fDiffY# = (GetPointerY() - starty#)/1.0
newX# = angx# + fDiffY#
if ( newX# > 89 ) then newX# = 89
if ( newX# < -89 ) then newX# = -89
SetCameraRotation( 1, newX#, angy# + fDiffX#, 0 )
endif
return
I'm not a grumpy grandpa