I just tested the following example and it works well in studio
#constant KEY_UP = 38 //the up arrow key scancode
#constant KEY_DOWN = 40 //the down arrow key scancode
#constant KEY_LEFT = 37 //the left arrow key scancode
#constant KEY_RIGHT = 39 //the right arrow key scancode
// show all errors
SetErrorMode(2)
// set window properties
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
textureImage1=createtexture(256,256, makecolor(255,255,255),155) //must be power of 2
textureImage2=createtexture(32,32, makecolor(255,255,255),50) //must be power of 2
leftPlane=CreateObjectPlane(40, 40 )
SetObjectImage(leftPlane,textureimage1,0)
SetObjectColor(leftPlane,0,200,0,255)
SetObjectRotation(LeftPlane,0,-90,0 )
SetObjectPosition(leftPlane,1,0,40)
SetObjectUVScale(LeftPlane,0,1,1)
rightPlane=CreateObjectPlane(40, 40 )
SetObjectImage(rightPlane,textureimage1,0)
SetObjectColor(rightPlane,0,200,0,255)
SetObjectRotation(rightPlane,0,-90,0 )
SetObjectPosition(rightPlane,40,0,40)
SetObjectUVScale(rightPlane,0,1,1)
bottomPlane=CreateObjectPlane(40, 40 )
SetObjectImage(bottomPlane,textureimage1,0)
SetObjectRotation(bottomPlane,90,0,0 )
SetObjectPosition(bottomPlane,20,-20,40)
SetObjectUVScale(bottomPlane,0,1,1)
backPlane=CreateObjectPlane(40, 40 )
SetObjectImage(backPlane,textureimage2,0)
SetObjectColor(backPlane,0,0,200,255)
SetObjectPosition(backPlane,20,0,60)
SetImageWrapU( textureimage1, 1 )
SetImageWrapV( textureimage1, 1 )
setCameraPosition(1,40/2,10,2)
SetSunActive(1)
SetSunColor( 255, 255,255 )
SetFogSunColor( 20, 20, 20 )
//Add some atmosphere
//SetFogMode( 1 )
//SetFogColor(20,20,20)
//SetFogRange(10,100)
SetShadowMappingMode(3 )
SetShadowSmoothing( 0)
SetShadowMapSize( 512, 512 )
SetShadowRange( -1 ) // use the full camera range
leftU#=0:rightU#=0:bottomU#=0:bottomV#=0
do
if GetRawKeyState (KEY_Up)
leftU#=leftU#+.1:rightU#=rightU#-.1:bottomV#=bottomV#-.1
SetObjectUVOffset(leftPlane,0,leftU#,0 )
SetObjectUVOffset(rightPlane,0,rightU#,0 )
SetObjectUVOffset(bottomPlane,0,bottomU#,bottomV# )
endif
if GetRawKeyState (KEY_Down)
leftU#=leftU#-.1:rightU#=rightU#+.1:bottomV#=bottomV#+.1
SetObjectUVOffset(leftPlane,0,leftU#,0 )
SetObjectUVOffset(rightPlane,0,rightU#,0 )
SetObjectUVOffset(bottomPlane,0,bottomU#,bottomV# )
endif
if GetRawKeyState (KEY_Left)
bottomU#=bottomU#-.1
SetObjectUVOffset(bottomPlane,0,bottomU#,bottomV# )
endif
if GetRawKeyState (KEY_Right)
bottomU#=bottomU#+.1
SetObjectUVOffset(bottomPlane,0,bottomU#,bottomV# )
endif
Print( ScreenFPS() )
Sync()
loop
// 102, 51, 0
// Function to create a texture
// by Puzzler
// Inputs - Sizex - size of the texture to create - width
// Sizey - size of the texture to create - height
// Color - is the main color of the image
// Denisity - is a the depth of the texture - the lower the value, the more detail. higher value = no detail
//
// Returns the image for the resulting texture
//
// EG. CreateTexture ( 100, 100, makecolor(0,0,255), 100)
// This could create a DEEP water effect texture?
function createtexture(sizex# as float, sizey# as float, color, density as integer)
swap()
drawbox(0,0,sizex#, sizey#, color, color,color,color, 1)
render()
img = getimage(0,0,sizex#, sizey#)
memblockid = CreateMemblockFromImage (img)
imgwidth = GetMemblockInt(memblockid, 0)
imgheight = GetMemblockInt(memblockid, 4)
size=GetMemblockSize(memblockid)
for offset=12 to size-4 step 4
r=GetMemblockByte(memblockid, offset)
g=GetMemblockByte(memblockid, offset+1)
b=GetMemblockByte(memblockid, offset+2)
a=GetMemblockByte(memblockid, offset+3)
strength=random(1,density)
SetMemblockByte (memblockid, offset, r-strength)
SetMemblockByte (memblockid, offset+1, g-strength)
SetMemblockByte (memblockid, offset+2, b-strength )
SetMemblockByte (memblockid, offset+3, a-strength)
next
deleteimage (img)
img = CreateImageFromMemblock(memblockid)
DeleteMemblock(memblockid)
endfunction img