magic island terrain editor scene saver loader loads a height map a simple edit system very basic
all has load and object so far handles .x and fbx easy to add more just edit the getrawfile commands near the bottom
save the scen and a file could my data for easy loading to program /game all contens a copies to the media files in you user app data /local folder
so you can just copy the hole folder to you new project
copy the types and the load function from the program and it should work o well good luck
//// creat a loadable scen in 5 mins or leessss
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "terrain" )
SetWindowSize( 1024, 1024, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 1024 ) // 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
//#include ".\..\Templates\ShaderPack\Includes\ShaderPack.agc"
setcameraposition(1,0,5,0)
SetCameraRotation(1,0,0,0)
SetCameraRange(1,1,2000)
global d$
d$=GetCurrentDir()
type objects
o as integer []
file as string []
x as float []
y as float []
z as float []
ax as float []
ay as float []
az as float []
scale as float[]
texture as integer [10000]
texture_file as string [10000]
texture1 as integer [10000]
texture_file1 as string [10000]
texture2 as integer [10000]
texture_file2 as string [10000]
texture3 as integer [10000]
texture_file3 as string [10000]
texture4 as integer [10000]
texture_file4 as string [10000]
texture5 as integer [10000]
texture_file5 as string [10000]
texture6 as integer [10000]
texture_file6 as string [10000]
endtype
global obj as objects
type skybox_images
i1 as integer [100]
i2 as integer [100]
i3 as integer [100]
i4 as integer [100]
i5 as integer [100]
i6 as integer [100]
endtype
global sky as skybox_images
dim images[1000] as string
dim image[1000]
dim maps[1000] as string
dim models[500] as integer
dim ftexture[500] as integer
dim ftexture_name[500] as string
global radious,ols,ste,r,p_x,P_y,px,py,ter_size,water,wat, mydir$,col,land,water_level,hight,flat
global camerax#=0
global cameray#=5
global cameraz#=0
global file1$="\media\"
global box=1
global file$="\media\"
global ob=1
global th=255
global texture=6
global col1#,col2#,col3#
global draw_type=1
GLOBAL O_INDEX
flat=1
radious=4
water_level=40
hight=water_level
col1#=hight
col2#=hight
col3#=hight
ter_size=1024
//SetRawWritePath( GetReadPath())
AddVirtualButton(50,50,50,100)
AddVirtualButton(51,150,50,100)
AddVirtualButton(52,250,50,100)
AddVirtualButton(53,350,50,100)
AddVirtualButton(54,450,50,100)
AddVirtualButton(55,550,50,100)
AddVirtualButton(56,650,50,100)
AddVirtualButton(57,750,50,100)
AddVirtualButton(58,850,50,100)
AddVirtualButton(59,950,50,100)
AddVirtualButton(2,50,150,100)
AddVirtualButton(1,150,150,100)
SetVirtualButtonText( 1, "height +" )
SetVirtualButtonText( 2, "height -" )
AddVirtualButton(3,50,250,100)
AddVirtualButton(4,150,250,100)
SetVirtualButtonText( 3, "radious -" )
SetVirtualButtonText( 4, "radious +" )
AddVirtualButton(5,50,350,100)
SetVirtualButtonText( 5, "flat" )
AddVirtualButton(9,50,450,100)
SetVirtualButtonText( 9, "draw mode" )
AddVirtualButton(12,50,650,100)
AddVirtualButton(13,150,650,100)
SetVirtualButtonText( 12, "tex - " )
SetVirtualButtonText( 13 , "tex +" )
AddVirtualButton(14,50,750,100)
SetVirtualButtonText( 14 , "radomize +" )
AddVirtualButton(30,50,900,100)
SetVirtualButtonText( 30 , "new obj" )
AddVirtualButton(31,150,900,100)
SetVirtualButtonText( 31 , "Animate" )
AddVirtualButton(32,250,900,100)
SetVirtualButtonText( 32 , "obj +" )
AddVirtualButton(33,350,900,100)
SetVirtualButtonText( 33 , "obj - " )
AddVirtualButton(34,450,900,100)
SetVirtualButtonText( 34 , "sc +" )
AddVirtualButton(35,550,900,100)
SetVirtualButtonText( 35 , "sc - " )
AddVirtualButton(36,625,925,50)
SetVirtualButtonText( 36 , "x +" )
AddVirtualButton(37,625,975,50)
SetVirtualButtonText( 37 , "x -" )
AddVirtualButton(38,675,925,50)
SetVirtualButtonText( 38 , "y +" )
AddVirtualButton(39,675,975,50)
SetVirtualButtonText( 39 , "y -" )
AddVirtualButton(40,725,925,50)
SetVirtualButtonText( 40 , "z +" )
AddVirtualButton(41,725,975,50)
SetVirtualButtonText( 41 , "z -" )
AddVirtualButton(42,775,925,50)
SetVirtualButtonText( 42 , "rx +" )
AddVirtualButton(43,775,975,50)
SetVirtualButtonText( 43 , "rx -" )
AddVirtualButton(44,825,925,50)
SetVirtualButtonText( 44 , "ry +" )
AddVirtualButton(45,825,975,50)
SetVirtualButtonText( 45 , "ry -" )
AddVirtualButton(46,875,925,50)
SetVirtualButtonText( 46 , "rz +" )
AddVirtualButton(47,875,975,50)
SetVirtualButtonText( 47 , "rz -" )
AddVirtualButton(60,625,825,50)
SetVirtualButtonText( 60 , "x +" )
AddVirtualButton(61,625,875,50)
SetVirtualButtonText( 61 , "x -" )
AddVirtualButton(62,675,825,50)
SetVirtualButtonText( 62 , "y +" )
AddVirtualButton(63,675,875,50)
SetVirtualButtonText( 63 , "y -" )
AddVirtualButton(64,725,825,50)
SetVirtualButtonText( 64 , "z +" )
AddVirtualButton(65,725,875,50)
SetVirtualButtonText( 65 , "z -" )
AddVirtualButton(66,775,825,50)
SetVirtualButtonText( 66 , "rx +" )
AddVirtualButton(67,775,875,50)
SetVirtualButtonText( 67 , "rx -" )
AddVirtualButton(68,825,825,50)
SetVirtualButtonText( 68 , "ry +" )
AddVirtualButton(69,825,875,50)
SetVirtualButtonText( 69 , "ry -" )
AddVirtualButton(70,875,825,50)
SetVirtualButtonText( 70 , "rz +" )
AddVirtualButton(71,875,875,50)
SetVirtualButtonText( 71 , "rz -" )
SetVirtualButtonText(52,"set tex 1")
SetVirtualButtonText(53,"set tex 2")
SetVirtualButtonText(54,"set tex 3")
SetVirtualButtonText(55,"set tex 4")
SetVirtualButtonText(56,"set tex 5")
SetVirtualButtonText(57,"set tex 6")
SetVirtualButtonText(58,"set tex 7")
SetVirtualButtonText(59,"Create")
//SP_Init()
//WaterNormalImageID=LoadImage("\media\waterNormal.png")
// SetImageWrapU(WaterNormalImageID,1)
// SetImageWrapV(WaterNormalImageID,1)
WaterObjectID=CreateObjectPlane(1024,1024)
SetObjectColor(WaterObjectID,0,0,200,255)
RotateObjectLocalX(WaterObjectID,90)
FixObjectPivot(WaterObjectID)
// SetObjectUVScale(WaterObjectID,0,8,8)
// SP_Water_AddObject(WaterObjectID,WaterNormalImageID)
MoveObjectLocalY(WaterObjectID,water_level/2)
MoveObjectLocalx(WaterObjectID,ter_size/2)
MoveObjectLocalz(WaterObjectID,ter_size/2)
SetCurrentDir("\media\textures\")
count1=0
fn$=GetFirstFile()
while fn$<>""
if FindString(fn$,".png") or FindString(fn$,".jpg")
Inc count1
images[count1]="\media\textures\"+fn$
endif
fn$=GetNextFile()
endwhile
SetCurrentDir(d$)
count=0
for p=1 to 5
SetCurrentDir("\media\maps\waves"+str(p)+"\")
fn$=GetFirstFile()
while fn$<>""
if FindString(fn$,".png") or FindString(fn$,".jpg")
Inc count
maps[count]="\media\maps\waves"+str(p)+"\"+fn$
endif
fn$=GetNextFile()
endwhile
SetCurrentDir(d$)
next
SetCurrentDir(d$)
SetFolder("\media\")
AddVirtualButton(90,300,300,100)
AddVirtualButton(91,500,300,100)
AddVirtualButton(92,700,300,100)
SetVirtualButtonText(90,"LOAD")
SetVirtualButtonText(91,"NEW")
SetVirtualButtonText(92,"Heightmap")
REPEAT
IF GetVirtualButtonPressed(90)
LOAD=1
EX=1
ENDIF
IF GetVirtualButtonPressed(91)
LOAD=0
EX=1
DeleteFile("\media\MY_LEVEL_DATA.DATA")
ENDIF
IF GetVirtualButtonPressed(92)
LOAD=2
EX=1
DeleteFile("\media\MY_LEVEL_DATA.DATA")
ENDIF
SYNC()
UNTIL EX=1
DeleteVirtualButton(90)
DeleteVirtualButton(91)
DeleteVirtualButton(92)
if load=0
file1$="template image.png"
get$="\media\"+file1$
endif
if load=2
ChooseRawFile("*.png")
get$="\media\"+file1$
endif
if load=1
get$="\media\myimage.png"
endif
createObjectFromHeightMap(2,get$,ter_size,th,ter_size,16,4)
imag=loadimage(images[texture])
setobjectimage(2,imag,0)
SetObjectCollisionMode(2,1)
loadimage( 90,get$)
file$="\media\"
get$=""
CreateObjectbox(10,10,10,10)
SetObjectPosition(10,ter_size/2,water_level+10,ter_size/2)
CreateObjectbox(11,10,10,10)
SetObjectPosition(11,ter_size/2,water_level+10,ter_size/2)
SetCameraPosition(1,ter_size/2,water_level+10,ter_size/2)
SetCameraRotation(1,0,0,0)
SetObjectVisible(10,0)
SetObjectCollisionMode(10,0)
SetObjectCollisionMode(11,0)
SetObjectCollisionMode(WaterObjectID,0)
SetObjectCollisionMode(10,0)
SetObjectCollisionMode(11,0)
pivit=CreateObjectSphere(0.1,32,32)
sky_top=createobjectbox(1000,1,1000)
sky_bottom=createobjectbox(1000,1,1000)
sky_frount=createobjectbox(1000,1000,1)
sky_back=createobjectbox(1000,1000,1)
sky_left=createobjectbox(1,1000,1000)
sky_right=createobjectbox(1,1000,1000)
FixObjectToObject(sky_top,pivit)
FixObjectToObject(sky_bottom,pivit)
FixObjectToObject(sky_frount,pivit)
FixObjectToObject(sky_back,pivit)
FixObjectToObject(sky_left,pivit)
FixObjectToObject(sky_right,pivit)
MoveObjectLocalY(sky_top,500)
MoveObjectLocalY(sky_bottom,-500)
MoveObjectLocalz(sky_frount,500)
MoveObjectLocalz(sky_back,-500)
MoveObjectLocalx(sky_left,500)
MoveObjectLocalx(sky_right,-500)
MoveObjectLocaly(sky_frount,500)
MoveObjectLocaly(sky_back,500)
MoveObjectLocaly(sky_left,500)
MoveObjectLocaly(sky_right,500)
for p=1 to 13
sky.i1[p]=loadimage("\media\skyboxes\"+str(p)+"\up-min.png")
sky.i2[p]=loadimage("\media\skyboxes\"+str(p)+"\down-min.png")
sky.i3[p]=loadimage("\media\skyboxes\"+str(p)+"\frount-min.png")
sky.i4[p]=loadimage("\media\skyboxes\"+str(p)+"\back-min.png")
sky.i5[p]=loadimage("\media\skyboxes\"+str(p)+"\left-min.png")
sky.i6[p]=loadimage("\media\skyboxes\"+str(p)+"\right-min.png")
next
SetObjectImage(sky_top,sky.i1[1],0)
SetObjectImage(sky_bottom,sky.i2[1],0)
SetObjectImage(sky_frount,sky.i3[1],0)
SetObjectImage(sky_back,sky.i4[1],0)
SetObjectImage(sky_left,sky.i5[1],0)
SetObjectImage(sky_right,sky.i6[1],0)
SetObjectLightMode(sky_top,0)
SetObjectLightMode(sky_bottom,0)
SetObjectLightMode(sky_frount,0)
SetObjectLightMode(sky_back,0)
SetObjectLightMode(sky_left,0)
SetObjectLightMode(sky_right,0)
SetObjectPosition(pivit,1024/2,0,1024/2)
RotateObjectLocalY(sky_top,-90)
if load=1
LOADOBJECTS()
endif
do
if o_index>0
layer=0
for p=52 to 58
if GetVirtualButtonPressed(p)
Choosetexture()
if file1$<>""
get$="\media\"+file1$
select layer
case 0
obj.texture[o_index-1]=loadimage(get$)
obj.texture_file[o_index-1]=get$
SetObjectImage(obj.o[o_index-1],obj.texture[o_index-1],0)
endcase
case 1
obj.texture1[o_index-1]=loadimage(get$)
obj.texture_file1[o_index-1]=get$
SetObjectImage(obj.o[o_index-1],obj.texture[o_index-1],1)
endcase
case 2
obj.texture2[o_index-1]=loadimage(get$)
obj.texture_file2[o_index-1]=get$
SetObjectImage(obj.o[o_index-1],obj.texture[o_index-1],2)
endcase
case 3
obj.texture3[o_index-1]=loadimage(get$)
obj.texture_file3[o_index-1]=get$
SetObjectImage(obj.o[o_index-1],obj.texture[o_index-1],3)
endcase
case 4
obj.texture4[o_index-1]=loadimage(get$)
obj.texture_file4[o_index-1]=get$
SetObjectImage(obj.o[o_index-1],obj.texture[o_index-1],4)
endcase
case 5
obj.texture5[o_index-1]=loadimage(get$)
obj.texture_file5[o_index-1]=get$
SetObjectImage(obj.o[o_index-1],obj.texture[o_index-1],5)
endcase
case 6
obj.texture6[o_index-1]=loadimage(get$)
obj.texture_file6[o_index-1]=get$
SetObjectImage(obj.o[o_index-1],obj.texture[o_index-1],6)
endcase
endselect
endif
endif
inc layer
next
endif
if GetVirtualButtonState(33)
if ob>1
dec ob
endif
endif
if GetVirtualButtonState(34)=1 and o_index>0
osc#=osc#+0.01
SetObjectScale(obj.o[o_index-1],osc#,osc#,osc#)
obj.scale[o_index-1]=osc#
endif
if GetVirtualButtonState(35) and o_index>0
osc#=osc#-0.01
SetObjectScale(obj.o[o_index-1],osc#,osc#,osc#)
obj.scale[o_index-1]=osc#
endif
if GetVirtualButtonPressed(30)
osc#=1
ChooseFile()
if file$<>""
get$="\media\"+file$
obj.o.insert(loadobject(get$))
obj.file.insert(get$)
new_x# = GetobjectworldX(11)
new_y# = Getobjectworldy(11)
new_z# = Getobjectworldz(11)
obj.x.insert(new_x#)
obj.y.insert(new_y#)
obj.z.insert(new_z#)
obj.ax.insert(0.0)
obj.ay.insert(0.0)
obj.az.insert(0.0)
obj.scale.insert(osc#)
SetObjectPosition(obj.o[o_index],obj.x[o_index],obj.y[o_index],obj.z[o_index])
SetObjectVisible(obj.o[o_index],1)
SetObjectAlphaMask(obj.o[o_index],1)
SetObjectScale(obj.o[o_index],osc#,osc#,osc#)
SetObjectCollisionMode(obj.o[o_index],0)
o_index=o_index+1
endif
endif
if o_index>0
if GetVirtualButtonState(36)=1
MoveObjectLocalX( obj.o[o_index-1],0.1)
new_x# = GetobjectworldX(obj.o[o_index-1])
obj.x[o_index-1]=new_x#
endif
if GetVirtualButtonState(60)=1
MoveObjectLocalX( obj.o[o_index-1],1)
new_x# = GetobjectworldX(obj.o[o_index-1])
obj.x[o_index-1]=new_x#
endif
if GetVirtualButtonState(37)=1
MoveObjectLocalX( obj.o[o_index-1],-0.1)
new_x# = GetobjectworldX(obj.o[o_index-1])
obj.x[o_index-1]=new_x#
endif
if GetVirtualButtonState(61)=1
MoveObjectLocalX( obj.o[o_index-1],-1)
new_x# = GetobjectworldX(obj.o[o_index-1])
obj.x[o_index-1]=new_x#
endif
if GetVirtualButtonState(38)=1
MoveObjectLocaly( obj.o[o_index-1],0.1)
new_y# = Getobjectworldy(obj.o[o_index-1])
obj.y[o_index-1]=new_y#
endif
if GetVirtualButtonState(62)=1
MoveObjectLocaly( obj.o[o_index-1],1)
new_y# = Getobjectworldy(obj.o[o_index-1])
obj.y[o_index-1]=new_y#
endif
if GetVirtualButtonState(39)=1
MoveObjectLocaly( obj.o[o_index-1],-0.1)
new_y# = Getobjectworldy(obj.o[o_index-1])
obj.y[o_index-1]=new_y#
endif
if GetVirtualButtonState(63)=1
MoveObjectLocaly( obj.o[o_index-1],-1)
new_y# = Getobjectworldy(obj.o[o_index-1])
obj.y[o_index-1]=new_y#
endif
if GetVirtualButtonState(40)=1
MoveObjectLocalz( obj.o[o_index-1],0.1)
new_z# = Getobjectworldz(obj.o[o_index-1])
obj.z[o_index-1]=new_z#
endif
if GetVirtualButtonState(64)=1
MoveObjectLocalz( obj.o[o_index-1],1)
new_z# = Getobjectworldz(obj.o[o_index-1])
obj.z[o_index-1]=new_z#
endif
if GetVirtualButtonState(41)=1
MoveObjectLocalz( obj.o[o_index-1],-0.1)
new_z# = Getobjectworldz(obj.o[o_index-1])
obj.z[o_index-1]=new_z#
endif
if GetVirtualButtonState(65)=1
MoveObjectLocalz( obj.o[o_index-1],-1)
new_z# = Getobjectworldz(obj.o[o_index-1])
obj.z[o_index-1]=new_z#
endif
endif
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
if o_index>0
if GetVirtualButtonState(42)=1
rotateObjectLocalX( obj.o[o_index-1],0.1)
new_x# = GetObjectWorldAngleX(obj.o[o_index-1])
obj.ax[o_index-1]=new_x#
endif
if GetVirtualButtonState(66)=1
rotateObjectLocalX( obj.o[o_index-1],1)
new_x# = GetObjectWorldAngleX(obj.o[o_index-1])
obj.ax[o_index-1]=new_x#
endif
if GetVirtualButtonState(43)=1
rotateObjectLocalX( obj.o[o_index-1],-0.1)
new_x# = GetObjectWorldAngleX(obj.o[o_index-1])
obj.ax[o_index-1]=new_x#
endif
if GetVirtualButtonState(67)=1
rotateObjectLocalX( obj.o[o_index-1],-1)
new_x# = GetObjectWorldAngleX(obj.o[o_index-1])
obj.ax[o_index-1]=new_x#
endif
if GetVirtualButtonState(44)=1
rotateObjectLocaly( obj.o[o_index-1],0.1)
new_y# = GetObjectWorldAngleY(obj.o[o_index-1])
obj.ay[o_index-1]=new_y#
endif
if GetVirtualButtonState(68)=1
rotateObjectLocaly( obj.o[o_index-1],1)
new_y# = GetObjectWorldAngleY(obj.o[o_index-1])
obj.ay[o_index-1]=new_y#
endif
if GetVirtualButtonState(45)=1
rotateObjectLocaly( obj.o[o_index-1],-0.1)
new_y# = GetObjectWorldAngleY(obj.o[o_index-1])
obj.ay[o_index-1]=new_y#
endif
if GetVirtualButtonState(69)=1
rotateObjectLocaly( obj.o[o_index-1],-1)
new_y# = GetObjectWorldAngleY(obj.o[o_index-1])
obj.ay[o_index-1]=new_y#
endif
if GetVirtualButtonState(46)=1
rotateObjectLocalz( obj.o[o_index-1],0.1)
new_z# = GetObjectWorldAngleZ(obj.o[o_index-1])
obj.az[o_index-1]=new_z#
endif
if GetVirtualButtonState(70)=1
rotateObjectLocalz( obj.o[o_index-1],1)
new_z# = GetObjectWorldAngleZ(obj.o[o_index-1])
obj.az[o_index-1]=new_z#
endif
if GetVirtualButtonState(47)=1
rotateObjectLocalz( obj.o[o_index-1],-0.1)
new_z# = GetObjectWorldAngleZ(obj.o[o_index-1])
obj.az[o_index-1]=new_z#
endif
if GetVirtualButtonState(71)=1
rotateObjectLocalz( obj.o[o_index-1],-1)
new_z# = GetObjectWorldAngleZ(obj.o[o_index-1])
obj.az[o_index-1]=new_z#
endif
endif
if GetRawKeyState(49)=1
inc box
if box>13 then box=1
SetObjectImage(sky_top,sky.i1[box],0)
SetObjectImage(sky_bottom,sky.i2[box],0)
SetObjectImage(sky_frount,sky.i3[box],0)
SetObjectImage(sky_back,sky.i4[box],0)
SetObjectImage(sky_left,sky.i5[box],0)
SetObjectImage(sky_right,sky.i6[box],0)
endif
if GetVirtualButtonPressed(12)
if texture>1
dec texture,1
imag=loadimage(images[texture])
setobjectimage(2,imag,0)
endif
endif
if GetVirtualButtonPressed(13)
if texture<count1
inc texture,1
imag=loadimage(images[texture])
setobjectimage(2,imag,0)
endif
endif
if GetVirtualButtonState(51)
MoveObjectLocalY(WaterObjectID,1)
endif
if GetVirtualButtonState(50)
MoveObjectLocalY(WaterObjectID,-1)
endif
if GetRawKeyState(37)=1 and GetObjectWorldX(10)>10
rotateObjectLocaly(10,3)
rotateObjectLocaly(11,-3)
endif
if GetRawKeyState(39)=1 and GetObjectWorldX(10)>10
rotateObjectLocaly(10,-3)
rotateObjectLocaly(11,3)
endif
if GetRawKeyState(38)=1 and GetObjectWorldz(10)>10
MoveObjectLocalz(10,-3)
MoveObjectLocalz(11,3)
endif
if GetRawKeyState(40)=1
MoveObjectLocalz(10,3)
MoveObjectLocalz(11,-3)
endif
old_x# = GetobjectworldX(11)
old_y# = getobjectworldy(11)+255
old_z# = getobjectworldz(11)
new_x# = GetobjectworldX(11)
new_y# = Getobjectworldy(11)-255
new_z# = Getobjectworldz(11)
object_hit = ObjectRayCast(0,old_x#,old_y#,old_z#,new_x#,new_y#,new_z#)
if object_hit <> 0
// get the ray cast intersect point
intersect_x# = GetObjectRayCastX(0)
intersect_y# = GetObjectRayCastY(0)
intersect_z# = GetObjectRayCastZ(0)
// set the position of the blue sphere to the intersect point
Setobjectposition(11,intersect_x#,intersect_y#+5,intersect_z#)
endif
SetObjectPosition(pivit,getobjectworldx(11),0,getobjectworldz(11))
SetCameraPosition(1,getobjectworldx(11),intersect_y#+30,getobjectworldz(11))
SetCameraRotation(1,GetObjectWorldAngleX(11),GetObjectWorldAngley(11),GetObjectWorldAnglez(11))
MoveCameraLocalZ(1,-100)
if GetVirtualButtonReleased(14)
randomize(count)
endif
px=round(GetObjectWorldX(10))
py=round(GetObjectWorldz(10))
if GetPointerState()=1
drawtype1()
endif
if GetVirtualButtonState(1)=1
inc hight,1
endif
if GetVirtualButtonState(2)=1
if hight>0
dec hight,1
endif
endif
if GetVirtualButtonState(4)=1
inc radious,1
endif
if GetVirtualButtonState(3)=1
if radious>4
dec radious,1
endif
endif
if GetVirtualButtonState(5)=1:hight=water_level+1:endif
if GetVirtualButtonPressed(9)
drawmode()
endif
IF GetVirtualButtonPressed(59)
CREATE()
ENDIF
for t=1 to 255
if GetRawKeyState(t)
print(t)
endif
next
SetPrintColor(255,0,0)
print (file$)
print (file1$)
print ("_______________________________________________________________________________")
Print( "radious ="+str(radious) )
Print( "height ="+str(hight) )
print ("_______________________________________________________________________________")
print ("texture="+str(texture))
print (px)
print (py)
print ("press (1) to change skybox")
print ("set hieght/then set radius / then click screen thats it")
sync()
//SP_Sync()
loop
function drawtype1()
SetRenderToImage(90,0)
px=round(GetObjectWorldX(10))
py=round(GetObjectWorldz(10))
r=radious
j=r+10
DrawEllipse(px,py,j,j,MakeColor(hight,hight,hight),MakeColor(hight,hight,hight),1)
SaveImage( 90, "\media\myimage.png")
if GetObjectExists(2)
deleteobject(2)
endif
CreateObjectFromHeightMap(2,"\media\myimage.png",ter_size,th,ter_size,16,4)
imag=loadimage(images[texture])
setobjectimage(2,imag,0)
SetObjectCollisionMode(2,1)
SetRenderToScreen()
endfunction
function randomize(count)
ran=random(1,count)
th=130
if GetObjectExists(2)
deleteobject(2)
endif
deleteimage(90)
loadimage(90,maps[ran])
SaveImage( 90, "\media\myimage.png")
CreateObjectFromHeightMap(2,"\media\myimage.png",ter_size,th,ter_size,16,4)
imag=loadimage(images[texture])
setobjectimage(2,imag,0)
setObjectCollisionMode(2,1)
endfunction
function drawmode()
quit=0
old =radious
radious=4
wow=1
createsprite(1,90)
SetSpriteSize(1,1024,1024)
repeat
mx#=getpointerx()
my#=getpointery()
if GetVirtualButtonState(51)=1
if col3#<255
col3#=col3#+0.1
col2#=col2#+0.1
col1#=col1#+0.1
endif
endif
if GetVirtualButtonState(50)=1
if col3#>0
col3#=col3#-0.1
col2#=col2#-0.1
col1#=col1#-0.1
endif
endif
if GetVirtualButtonState(4)=1
inc radious,1
endif
if GetVirtualButtonState(3)=1
if radious>1
dec radious,1
endif
endif
if GetVirtualButtonState(55)=1
WOW=2
ENDIF
if GetVirtualButtonState(54)=1
WOW=1
ENDIF
if GetVirtualButtonState(54)=1
WOW=3
ENDIF
setrendertoimage(90,0)
if GetPointerState()=1 AND WOW=2
c1#=hight
c2#=hight
c3#=hight
R2#=100
FOR P=1 TO 500
if C1#<255
C1#=C1#+0.1
C2#=C2#+0.1
C3#=C3#+0.1
R2#=R2#-0.4
endif
DrawEllipse(mx#,my#,R2#,R2#*2,MakeColor(c1#,c2#,c3#),MakeColor(c1#,c2#,c3#),1)
NEXT
ENDIF
if GetPointerState()=1 AND WOW=3
c1#=hight
c2#=hight
c3#=hight
R2#=100
FOR P=1 TO 500
if C1#>0
C1#=C1#-0.1
C2#=C2#-0.1
C3#=C3#-0.1
R2#=R2#-0.4
endif
DrawEllipse(mx#,my#,R2#,R2#*2,MakeColor(c1#,c2#,c3#),MakeColor(c1#,c2#,c3#),1)
NEXT
ENDIF
if GetPointerState()=1 AND WOW=1
DrawEllipse(mx#,my#,radious,radious,MakeColor(col1#,col2#,col3#),MakeColor(col1#,col2#,col3#),1)
endif
SetRenderToScreen()
sync()
if GetRawKeyPressed(32) then quit=1
PRINT (COL1#)
PRINT (COL2#)
PRINT (COL3#)
PRINT (HIGHT)
PRINT ("WOW="+STR(WOW))
until quit=1
radious=old
if GetObjectExists(2)
deleteobject(2)
endif
SaveImage( 90, "\media\myimage.png")
CreateObjectFromHeightMap(2,"\media\myimage.png",ter_size,th,ter_size,1,8)
imag=loadimage(images[texture])
setobjectimage(2,imag,0)
SetObjectCollisionMode(2,1)
deletesprite(1)
endfunction
function ChooseFile()
file$=ChooseRawFile("*.x;*.fbx")
endfunction
function Choosetexture()
file1$=ChooseRawFile("*.png;*.jpg")
endfunction
FUNCTION CREATE()
OpenToWrite(1,"\media\MY_LEVEL_DATA.DATA")
WriteInteger(1,O_INDEX)
FOR P=0 TO O_INDEX-1
WriteString(1,OBJ.file[p])
WriteFloat (1,OBJ.x[P])
WriteFloat (1,OBJ.Y[P])
WriteFloat (1,OBJ.z[P])
obj.ax[p]=GetObjectWorldAngleX(obj.o[p])
obj.ay[p]=GetObjectWorldAngleY(obj.o[p])
obj.az[p]=GetObjectWorldAngleZ(obj.o[p])
WriteFloat (1,OBJ.ax[P])
WriteFloat (1,OBJ.ay[P])
WriteFloat (1,OBJ.az[P])
WriteFloat (1,obj.scale[p])
WriteString(1,OBJ.texture_file[p])
WriteString(1,OBJ.texture_file1[p])
WriteString(1,OBJ.texture_file2[p])
WriteString(1,OBJ.texture_file3[p])
WriteString(1,OBJ.texture_file4[p])
WriteString(1,OBJ.texture_file5[p])
WriteString(1,OBJ.texture_file6[p])
NEXT
CloseFile(1)
ENDFUNCTION
FUNCTION LOADOBJECTS()
OpenToREAD(1,"\media\MY_LEVEL_DATA.DATA")
O_INDEX=ReadInteger(1)
FOR P=0 TO O_INDEX-1
get$=ReadString(1)
obj.o.insert(loadobject(get$))
obj.file.insert(get$)
obj.x.insert(ReadFloat(1))
obj.y.insert(ReadFloat(1))
obj.z.insert(ReadFloat(1))
obj.ax.insert(ReadFloat(1))
obj.ay.insert(ReadFloat(1))
obj.az.insert(ReadFloat(1))
obj.scale.insert(ReadFloat(1))
SetObjectPosition(obj.o[P],obj.x[P],obj.y[P],obj.z[P])
SetObjectVisible(obj.o[P],1)
SetObjectAlphaMask(obj.o[P],1)
SetObjectScale(obj.o[P],obj.scale[P],obj.scale[P],obj.scale[P])
SetObjectRotation(OBJ.O[P],OBJ.AX[P],OBJ.AY[P],OBJ.AZ[P])
SetObjectCollisionMode(obj.o[P],0)
GET$=ReadString(1)
IF GET$<>""
OBJ.texture_file[p]=GET$
obj.texture[P]=loadimage(get$)
SetObjectImage(obj.o[P],obj.texture[P],1)
ENDIF
GET$=ReadString(1)
IF GET$<>""
OBJ.texture_file1[p]=GET$
obj.texture1[P]=loadimage(get$)
SetObjectImage(obj.o[P],obj.texture1[P],1)
ENDIF
GET$=ReadString(1)
IF GET$<>""
OBJ.texture_file2[p]=GET$
obj.texture2[P]=loadimage(get$)
SetObjectImage(obj.o[P],obj.texture2[P],1)
ENDIF
GET$=ReadString(1)
IF GET$<>""
OBJ.texture_file3[p]=GET$
obj.texture3[P]=loadimage(get$)
SetObjectImage(obj.o[P],obj.texture3[P],1)
ENDIF
GET$=ReadString(1)
IF GET$<>""
OBJ.texture_file4[p]=GET$
obj.texture4[P]=loadimage(get$)
SetObjectImage(obj.o[P-1],obj.texture4[P],1)
ENDIF
GET$=ReadString(1)
IF GET$<>""
OBJ.texture_file5[p]=GET$
obj.texture5[P]=loadimage(get$)
SetObjectImage(obj.o[P-1],obj.texture5[P],1)
ENDIF
GET$=ReadString(1)
IF GET$<>""
OBJ.texture_file6[p]=GET$
obj.texture6[P]=loadimage(get$)
SetObjectImage(obj.o[P-1],obj.texture6[P],1)
ENDIF
NEXT
CLOSEFILE(1)
ENDFUNCTION