zeus, here's some code to help you along with the crossed-plane trees (specifcally, check the _maketree: sub-routine). note, the code looks for your "reg_tree03.png" texture so drop it in the project folder here to test the code as-is.
Rem Project: xtree by Virtual Nomad
Rem Created: 10/31/2009 8:00:18 AM
Rem ***** Main Source File *****
sw = desktop width() : sh = desktop height()
set display mode sw,sh,32,1
sync on : sync rate 60
autocam off : backdrop on
if file exist ("reg_tree03.png") = 1
load image "reg_tree03.png",1,1
else
shutdown = timer() + 5000
repeat
center text sw/2,sh/2,"Image Does Not Exist!"
center text sw/2,(sh/2)+20,"Closing in "+str$( (shutdown-timer())/1000)
sync
until timer() > shutdown
end
endif
position camera 0.0,256.0,-512.0
point camera 0.0,256.0,0.0
rem set initial transparency setting
TranSet = 6
do
if object exist(1) = 1
gosub _move:
rem F3 to set tree object
if keystate(61) = 1 and lastkey + 1000 < timer()
gosub _settree:
lastkey = timer()
endif
endif
rem S = save tree
if keystate(31) = 1 and lastkey + 1000 < timer()
if object exist (1) = 1
gosub _savetree:
else
center text sw/2,sh/2,"No Tree Object Exists!"
sync
wait 2000
endif
lastkey = timer()
endif
rem L = load tree
if keystate(38) = 1 and lastkey + 1000 < timer()
gosub _loadtree:
lastkey = timer()
endif
rem M = make tree
if keystate(50) = 1 and lastkey + 1000 < timer()
gosub _maketree:
lastkey = timer()
endif
set cursor 0,0
print "Arrowkeys to Rotate/Zoom"
print "M = Make Tree"
print "S = Save Tree"
print "L = Load Tree"
print "F3 = Adjust Tree Object Settings"
print scancode()
sync
loop
_move:
rem rotate tree with left/right arrow
leftright# = (rightkey()-leftkey())*1.0
if leftright# <> 0.0
yrotate object 1, wrapvalue(object angle y(1) + leftright#)
endif
rem move camera in/out
zoom# = (upkey() - downkey())*1.0
if zoom# <> 0.0
move camera zoom#
endif
return
_maketree:
if object exist(1) = 1
delete object 1
endif
make object plane 1,512.0,512.0
offset limb 1,0,0.0,256.0,0.0
make mesh from object 1,1
add limb 1,1,1
rotate limb 1,1,0.0,90.0,0.0
texture object 1,1
set object texture 1,2,1
set object transparency 1,TranSet
set object cull 1,0
set object light 1,0
delete mesh 1
return
_savetree:
this = 0
rem find filename
repeat
thisfile$ = "tree_"+str$(this)+".dbo"
this = this + 1
until file exist (thisfile$) = 0
save object thisfile$,1
center text sw/2,sh/2,"Tree saved as "+thisfile$
center text sw/2,(sh/2)+20,"Press Any Key to Continue"
sync
wait key
return
_loadtree:
cls
repeat
delete object 1
until object exist(1) = 0
this = 0
repeat
if keystate(88) = 1 `check f12 for abort search
cls
center text sw/2,sh/2,"File Search Aborted"
sync
wait 1000
return
endif
thisfile$ = "tree_"+str$(this)+".dbo"
center text sw/2,sh/2,"Searching for "+thisfile$
center text sw/2,(sh/2)+20,"F12 to Stop Searching"
this = this + 1
sync
until file exist(thisfile$) = 1
load object thisfile$,1
center text sw/2,sh/2,"Tree "+thisfile$+" loaded"
center text sw/2,(sh/2)+20,"Press Any Key to Continue"
sync
wait key
return
_settree:
repeat
gosub _move:
set cursor 0,0
print "Arrowkeys to Rotate/Zoom"
print "Page Up/Down to Change Transparency Setting"
print "Current Transparency Setting: ",TranSet
print "<RETURN> = Exit Object Settings"
if lastkey + 200 < timer()
if keystate(201) = 1 `Page Up
TranSet = TranSet + 1
if TranSet > 6 then TranSet = 0
set object transparency 1,TranSet
lastkey = timer()
endif
if keystate(209) = 1 `Page Down
TranSet = TranSet - 1
if TranSet < 0 then TranSet = 6
set object transparency 1,TranSet
lastkey = timer()
endif
endif
sync
until returnkey() = 1
return
i suggest allowing the user to make some adjustments to the object(s) within the app. the code included allows for transparency settings, as an example.
also, consider allowing the user to set up the "environment" so they can see what the tree will look like in their game (with their settings, ie light, fog, etc, etc).
without these options, the code generation function isn't much help.
good luck!