Added them to be textural
// Project: chair
// Created: 2017-12-15
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "chair" )
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
player = CreateObjectSphere(1,20,20)
table = createobject(4,"table:\media\test.png",3)
chair = createobject(1,"stool:\media\test.png",3)
chair1 = createobject(1,"stool:\media\test.png",3)
chair2 = createobject(1,"stool:\media\test.png",3)
chair3 = createobject(1,"stool:\media\test.png",3)
stairs = createobject(2,"stairs",50)
stairs1 = createobject(2,"stairs",50)
// Create some flames
global flame as integer[4]
global flamecreationcounter=1
for loops=0 to 4
flame[loops] = createobject(1,"fire",1)
next
// end of flames creations
picture = createobject(5,"picture:\media\test.png",1)
angx#=0: angy#=0:angz#=0
camx#=0: camy#=0:camz#=0
do
// place the player
SetObjectPosition(player,camx#,camy#,camz#)
// place the chairs around a table
SetObjectPosition(chair,5,-4,8)
SetObjectPosition(chair1,5,-4,-8)
SetObjectPosition(chair2,-5,-4,8)
SetObjectPosition(chair3,-5,-4,-8)
//
SetObjectPosition(stairs,10,0,0)
Set3dParticlesPosition(flame[0], -3,1,0)
Set3dParticlesPosition(flame[1], 3,1,0)
//Set3dParticlesPosition(flame[2], 0,1,0)
Set3dParticlesPosition(flame[3], -3,1,-8)
Set3dParticlesPosition(flame[4], 3,1,-8)
SetObjectPosition(stairs1,-10,0,0)
SetObjectRotation(stairs1,10,0,0)
// Position picture
SetObjectPosition(picture, 0,5,20)
SetObjectRotation(chair, angx#-180, angy#, angz#)
SetObjectRotation(chair1, angx#-180, angy#, angz#)
SetObjectRotation(chair2, angx#-180, angy#, angz#)
SetObjectRotation(chair3, angx#-180, angy#, angz#)
SetObjectRotation(table, angx#-180, angy#, angz#)
inc angx#,0
inc angz#,0
inc angy#,0
if GetRawKeyState(38) then inc camz#,.5
if GetRawKeyState(40) then dec camz#,.5
if GetRawKeyState(37) then dec camx#,.5
if GetRawKeyState(39) then inc camx#,.5
// SetCameraRotation(1,camx#, camy#, camz#)
SetCameraPosition(1,getobjectx(player),getobjecty(player)+10, getobjectz(player)-30)
//setCameraLookAt(1,getobjectx(player),getobjecty(player), getobjectz(player),0)
Print( ScreenFPS() )
Sync()
loop
// seat = stool howmany = not coded
// table howmany = not coded
// stairs howmany = how many steps
// fire howmany = 1
// picture howmany = 1 - the seat string combines the image that it needs to load the picture
function createobject(size#, seat as string, howmany as integer)
height#=.5
diameter#=size# * 2
segments#=20
legs as integer[4]
if mid(seat,1,5)="stool"
chair=CreateObjectCylinder(height#,diameter#,segments#)
SetObjectImage(chair,loadimage(mid(seat,7,len(seat))),1)
// Build legs for round seat
legs[1] = CreateObjectCylinder(height#*diameter#*2, diameter#/(size# * 4), segments#)
FixObjectToObject(legs[1],chair)
SetObjectPosition(legs[1],getobjectx(chair)-(diameter#/2),getobjecty(chair)+diameter#/2,getobjectz(chair))
legs[2] = CreateObjectCylinder(height#*diameter#*2, diameter#/(size# * 4), segments#)
FixObjectToObject(legs[2],chair)
SetObjectPosition(legs[2],getobjectx(chair)+(diameter#/2),getobjecty(chair)+diameter#/2,getobjectz(chair))
legs[3] = CreateObjectCylinder(height#*diameter#*2, diameter#/ (size# * 4), segments#)
FixObjectToObject(legs[3],chair)
SetObjectPosition(legs[3],getobjectx(chair),getobjecty(chair)+(diameter#/2),getobjectz(chair)+ (diameter#/2))
legs[4] = CreateObjectCylinder(height#*diameter#*2, diameter#/ (size# * 4), segments#)
FixObjectToObject(legs[4],chair)
SetObjectPosition(legs[4],getobjectx(chair),getobjecty(chair)+(diameter#/2),getobjectz(chair)- (diameter#/2))
SetObjectRotation(legs[1],0,0,25)
SetObjectRotation(legs[2],0,0,-25)
SetObjectRotation(legs[3],25,0,0)
SetObjectRotation(legs[4],-25,0,0)
endif
if mid(seat,1,5)="table"
chair=CreateObjectbox(size# * 2,height#,segments#/(size#/3))
SetObjectImage(chair, LoadImage(mid(seat,7,len(seat))),1)
// Build legs for round seat
legs[1] = CreateObjectCylinder(height#*diameter#*2, diameter#/(size# * 4), segments#)
FixObjectToObject(legs[1],chair)
SetObjectPosition(legs[1],getobjectx(chair)-(diameter#/2.3),getobjecty(chair)+diameter#/2,getobjectz(chair)+diameter#/1.2)
legs[2] = CreateObjectCylinder(height#*diameter#*2, diameter#/(size# * 4), segments#)
FixObjectToObject(legs[2],chair)
SetObjectPosition(legs[2],getobjectx(chair)+(diameter#/2.3),getobjecty(chair)+diameter#/2,getobjectz(chair)-diameter#/1.2)
legs[3] = CreateObjectCylinder(height#*diameter#*2, diameter#/ (size# * 4), segments#)
FixObjectToObject(legs[3],chair)
SetObjectPosition(legs[3],getobjectx(chair)-(diameter#/2.3),getobjecty(chair)+(diameter#/2),getobjectz(chair)- (diameter#/1.2))
legs[4] = CreateObjectCylinder(height#*diameter#*2, diameter#/ (size# * 4), segments#)
FixObjectToObject(legs[4],chair)
SetObjectPosition(legs[4],getobjectx(chair)+(diameter#/2.3),getobjecty(chair)+(diameter#/2),getobjectz(chair)+ (diameter#/1.2))
endif
if seat="stairs"
stairblocks as integer[99]
position#=0
for loops=0 to howmany
stairblocks[loops]=CreateObjectBox(size#*2, size#/3, 2)
if loops=1 then SetObjectPosition(stairblocks[loops],0,0,0)
if loops>1
SetObjectPosition(stairblocks[loops],getobjectx(stairblocks[loops-1]),getobjecty(stairblocks[loops-1])+GetObjectSizeMaxY(stairblocks[1]),getobjectz(stairblocks[loops-1])+GetObjectSizeMaxZ(stairblocks[1]))
FixObjectToObject(stairblocks[loops],stairblocks[1])
endif
next
chair = stairblocks[1]
endif
if seat="fire"
freq# = 1000 // per second
additive=1
life#=1.5
// create 3D particle emitter
Create3DParticles( flamecreationcounter, 3,1,0 )
Set3DParticlesPosition( flamecreationcounter, 0,0,0 )
Set3DParticlesDirection( flamecreationcounter, 0,1,0, 0 )
Set3DParticlesFrequency( flamecreationcounter, freq# )
Set3DParticlesLife( flamecreationcounter, life# )
Set3DParticlesSize( flamecreationcounter, .3 )
Set3DParticlesVelocityRange( flamecreationcounter, 0.5, 2.0 )
Set3DParticlesStartZone( flamecreationcounter, -.1,-.1,.1, .1,.1,.1 ) // appear anywhere in this box
Set3DParticlesDirectionRange( flamecreationcounter, 10, 10 ) // anywhere in a hemisphere
Set3DParticlesImage( flamecreationcounter, LoadImage("\media\particle.png"))
Set3DParticlesTransparency( flamecreationcounter, 1 )
// fade the particles out before they die
Add3DParticlesColorKeyFrame( flamecreationcounter, life#-.9, 255,255,255,255 )
Add3DParticlesColorKeyFrame( flamecreationcounter, life#-.6, 255,200,0,255 )
Add3DParticlesColorKeyFrame( flamecreationcounter, life#-.4, 255,100,0,255 )
Add3DParticlesColorKeyFrame( flamecreationcounter, life#-.02, 0,0,0,0 )
chair=flamecreationcounter
inc flamecreationcounter
endif
if mid(seat,1,7)="picture"
frame = CreateObjectBox(size#*2+.5, size#*2+.5, .5)
chair = CreateObjectBox(size#*2, size#*2, .6)
FixObjectToObject(chair,frame)
SetObjectImage(chair,LoadImage(mid(seat,9,len(seat))),1)
SetObjectRotation(chair,0,0,-90)
SetObjectRotation(frame,0,0,90)
chair=frame
endif
endfunction chair
Need those 3 media files
Shall come back to this in a few days once everyone had a ganders
D