ok.
why is my camera green screening? and why is my text motion blurring? those 2 things shouldn't happen. i attached an image.
`====================================================
` Post Bloom
`====================================================
` By EVOLVED
` www.evolved-software.com
`====================================================
`Set Up Display
Sw=1024:Sh=768
sync on : sync rate 60
hide mouse
disable escapekey
get_dx(9)
_________SET_UP_______:
sync on : sync rate 60
TBM_Initialize
type player
health# as float
actualhealth# as float
maxhealth# as float
magic# as float
actualmagic# as float
maxmagic# as float
X# as float
Y# as float
Z# as float
Speed# as float
TSpeed# as float
id as integer
endtype
type enemy
health# as float
actualhealth# as float
maxhealth# as float
magic# as float
actualmagic# as float
maxmagic# as float
X# as float
Y# as float
Z# as float
Speed# as float
TSpeed# as float
id as integer
endtype
type menu
id as integer
endtype
type footstep
id as integer
endtype
global texture
global detail
global ground
global loaded
#constant healthtube 1
#constant healthbarleftside 2
#constant healthbarrightside 3
#constant healthbar 4
#constant playerid 5
#constant obj11 6
#constant obj22 7
#constant obj33 8
#constant enemyid 9
#constant healthbarid 10
#constant magicbarid 11
#constant magicbar 12
#constant footid 1
#constant footid2 2
#constant footid3 3
#constant footid4 4
#constant footid5 5
#constant footid6 6
#constant footid7 7
#constant footid8 8
#constant footid9 9
#constant effectid 1
#constant effectid2 2
#constant effectid3 3
#constant effectid4 4
#constant effectid5 5
#constant cameraid 10000
#constant cameraid2 10001
#constant cameraid3 10002
set camera range .1,500
global p111 as player
global e111 as enemy
dim menuImage(20000) as menu
menuImage(healthtube).id=find free image(healthtube,100000)
menuImage(healthbarleftside).id=find free image(healthbarleftside,100000)
menuImage(healthbarrightside).id=find free image(healthbarrightside,100000)
menuImage(healthbar).id=find free image(healthbar,100000)
menuImage(magicbar).id=find free image(magicbar,100000)
dim Object(20000) as player
Object(playerid).id=find free object(playerid,100000)
Object(obj11).id=find free object(obj11,100000)
Object(obj22).id=find free object(obj22,100000)
Object(obj33).id=find free object(obj33,100000)
Object(effectid).id=find free effect(effectid,100000)
Object(effectid2).id=find free effect(effectid2,100000)
Object(effectid3).id=find free effect(effectid3,100000)
Object(effectid4).id=find free effect(effectid4,100000)
Object(effectid5).id=find free effect(effectid5,100000)
Object(cameraid).id=find free object(cameraid,100000)
Object(cameraid2).id=find free object(cameraid2,100000)
Object(cameraid3).id=find free object(cameraid3,100000)
`if mousex()>[img pos x] and mousex()<[img pos x+size x] and mousey()>[img pos y] and mousey()<[img pos y+size y]
Object(playerid).actualhealth#=100001
Object(playerid).health# = Object(playerid).actualhealth#
Object(playerid).maxhealth# = 100001
Object(playerid).actualmagic#=100001
Object(playerid).magic# = Object(playerid).actualmagic#
Object(playerid).maxmagic# = 100001
Object(playerid).X# = 0.0
Object(playerid).Y# = 1.0
Object(playerid).Z# = 0.0
if Object(playerid).magic#>Object(playerid).maxmagic# then Object(playerid).magic#=Object(playerid).maxmagic#
if Object(playerid).health#>Object(playerid).maxhealth# then Object(playerid).health#=Object(playerid).maxhealth#
`dim Vec111(111) as vector111
`Vec111(vectorid111).id=find free vector(vectorid111,100000)
dim Object2(20) as enemy
Object2(enemyid).id=find free object(enemyid,100000)
Object2(enemyid).actualhealth#=10000
Object2(enemyid).health#=Object2(enemyid).actualhealth#
Object2(enemyid).maxhealth# = 2000000.0
Object2(enemyid).actualmagic#=10000
Object2(enemyid).magic#=Object2(enemyid).actualmagic#
Object2(enemyid).maxmagic# = 2000000.0
Object2(enemyid).X# = 0.0
Object2(enemyid).Y# = 1.0
Object2(enemyid).Z# = 0.0
dim footstep1(9) as footstep
footstep1(footid).id = find free sound(footid, 100000)
footstep1(footid2).id = find free sound(footid2, 100000)
footstep1(footid3).id = find free sound(footid3, 100000)
footstep1(footid4).id = find free sound(footid4, 100000)
footstep1(footid5).id = find free sound(footid5, 100000)
footstep1(footid6).id = find free sound(footid6, 100000)
footstep1(footid7).id = find free sound(footid7, 100000)
footstep1(footid8).id = find free sound(footid8, 100000)
footstep1(footid9).id = find free sound(footid9, 100000)
LoadGame()
InitLandGen()
p1 = CreateVegetation("Objects\grass1.dbo", 6, 6, 6)
p2 = CreateVegetation("Objects\grass2.dbo", 4, 4, 4)
p3 = CreateVegetation("Objects\weed1.dbo", 4, 4, 4)
p4 = CreateVegetation("Objects\weed2.dbo", 4, 4, 4)
p5 = CreateVegetation("Objects\fern1.dbo", 4, 4, 4)
p6 = CreateVegetation("Objects\fern2.dbo", 4, 4, 4)
p7 = CreateVegetation("Objects\weed3.dbo", 1, 1, 1)
p8 = CreateVegetation("Objects\bush1.dbo", 3, 3, 3)
p9 = CreateVegetation("Objects\bush2.dbo", 3, 3, 3)
p10 = CreateVegetation("Objects\tropical1.dbo", 2, 2, 2)
p11 = CreateVegetation("Objects\rock1.dbo", 2, 2, 2)
p12 = CreateVegetation("Objects\rock2.dbo", 2, 2, 2)
p13 = CreateVegetation("Objects\reed1.dbo", 6, 6, 6)
p14 = CreateVegetation("Objects\reed2.dbo", 6, 6, 6)
p15 = CreateVegetation("Objects\scrub1.dbo", 5, 5, 5)
p16 = CreateVegetation("Objects\scrub2.dbo", 5, 5, 5)
p17 = CreateVegetation("Objects\scrub3.dbo", 5, 5, 5)
p18 = CreateVegetation("Objects\scrub4.dbo", 5, 5, 5)
p19 = CreateVegetation("Objects\mushroom1.dbo", 1, 1, 1)
p20 = CreateVegetation("Objects\mushroom2.dbo", 1, 1, 1)
p21 = CreateVegetation("Objects\lily1.dbo", 4, 4, 4)
p22 = CreateVegetation("Objects\lily2.dbo", 4, 4, 4)
p23 = CreateVegetation("Objects\skull.x", 100, 100, 100)
p24 = CreateVegetation("Objects\torso.x", 10, 10, 10)
p25 = CreateVegetation("Objects\claw sword.x", 4, 4, 4)
p26 = CreateVegetation("Objects\ottoman_helmet.x", 500, 500, 500)
p27 = CreateVegetation("Objects\rockblack.dbo", 4, 4, 4)
p28 = CreateVegetation("Objects\Celtic Cross.x", 500, 500, 500)
p29 = CreateVegetation("Objects\sago.dbo", 2, 2, 2)
i = LookUpEnv( "grassland")
if i > 0
` play sound footstep1(footid).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p1, 5900, 1)
AddVegetation(i, p2, 4000, 1)
AddVegetation(i, p3, 50, 1)
AddVegetation(i, p4, 50, 1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "desert")
if i > 0
` play sound footstep1(footid1).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p10, 5, 5)
AddVegetation(i, p29, 5, 5)
CreateEnvironment(i)
Endif
i = LookUpEnv( "rock")
if i > 0
` play sound footstep1(footid2).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p11, 20, 1)
AddVegetation(i, p12, 20, 1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "battlefield")
if i > 0
` play sound footstep1(footid3).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p23, 3, 1)
AddVegetation(i, p24, 2, 1)
AddVegetation(i, p25, 2, 1)
AddVegetation(i, p26, 2, 1)
AddVegetation(i, p27, 10, 2)
AddVegetation(i, p28, 5, 2)
CreateEnvironment(i)
Endif
i = LookUpEnv( "reeds")
if i > 0
` play sound footstep1(footid4).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p13, 6000, 1)
AddVegetation(i, p14, 4000, 1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "scrub")
if i > 0
` play sound footstep1(footid5).id
NewEnvironment(i, 1, 0)
AddVegetation(i, p15, 3000, 2)
AddVegetation(i, p16, 2000, 2)
AddVegetation(i, p17, 2000, 2)
AddVegetation(i, p18, 3000, 2)
CreateEnvironment(i)
Endif
i = LookUpEnv( "swamp")
if i > 0
` play sound footstep1(footid6).id
NewEnvironment(i, 0, 1)
AddDoubleVegetation(i, p13, p21, 6000, 1000, 1)
AddDoubleVegetation(i, p14, p22, 4000, 1000, 1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "forest")
if i > 0
` play sound footstep1(footid7).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p5, 100, 1)
AddVegetation(i, p6, 100, 1)
AddVegetation(i, p7, 9000, 1)
AddVegetation(i, p8, 10, 1)
AddVegetation(i, p9, 10, 1)
AddVegetation(i, p19, 10, .1)
AddVegetation(i, p20, 10, .1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "border")
if i > 0
` play sound footstep1(footid8).id
NewEnvironment(i, 1, 0)
CreateEnvironment(i)
Endif
JumpToPoint("Start")
CreateCover()
UpdateSky(45)
ts as float = 0
tmp = New Vector4()
set ambient light 100
load sound "walkl_br.wav", footstep1(footid).id
load sound "walkl_br.wav", footstep1(footid2).id
load sound "walkl_br.wav", footstep1(footid3).id
load sound "walkl_br.wav", footstep1(footid4).id
load sound "walkl_br.wav", footstep1(footid5).id
load sound "walkl_br.wav", footstep1(footid6).id
load sound "walkl_br.wav", footstep1(footid7).id
load sound "walkl_br.wav", footstep1(footid8).id
load sound "walkl_br.wav", footstep1(footid9).id
x#=0.0:y#=0.0:z#=0.0:turn=0:player=Object(playerid).id
`gosub Setupland1
`gosub make_player
`set global collision off
`sync rate 60
set camera range 10,40000
`gosub Resetcam
enable escapekey
`Setup Frame Image Render
Frame=PostFilter_SetUp(screen width(),screen height(),0)
set camera fov FrameCamera,80
set camera range FrameCamera,1,5000
set camera aspect FrameCamera,(screen width()/screen height())*1.25
`SetUp Glow Render Targets
Luminance1=PostFilter_RenderTarget_Add("fx/Luminance1.fx","",1,9,9,0)
PostFilter_RenderTarget_Image(Luminance1,0,RenderTarget(Frame).Image)
Luminance2=PostFilter_RenderTarget_Add("fx/Luminance2.fx","",1,3,3,0)
PostFilter_RenderTarget_Image(Luminance2,0,RenderTarget(Luminance1).Image)
Luminance3=PostFilter_RenderTarget_Add("fx/Luminance3.fx","",1,1,1,0)
PostFilter_RenderTarget_Image(Luminance3,0,RenderTarget(Luminance2).Image)
Brightpass=PostFilter_RenderTarget_Add("fx/BrightPass.fx","",0,256,256,0)
PostFilter_RenderTarget_Image(Brightpass,0,RenderTarget(1).Image)
BloomH=PostFilter_RenderTarget_Add("fx/BloomH.fx","",0,256,256,0)
PostFilter_RenderTarget_Image(BloomH,0,RenderTarget(Brightpass).Image)
BloomV=PostFilter_RenderTarget_Add("fx/BloomV.fx","",0,256,256,0)
PostFilter_RenderTarget_Image(BloomV,0,RenderTarget(BloomH).Image)
`Frame Target
FrameTarget=PostFilter_FrameTarget_Add("fx/FinalComp.fx","Bloom",1)
PostFilter_FrameTarget_Image(FrameTarget,0,RenderTarget(Frame).Image)
PostFilter_FrameTarget_Image(FrameTarget,1,RenderTarget(Luminance3).Image)
PostFilter_FrameTarget_Image(FrameTarget,2,RenderTarget(BloomV).Image)
`Start loop
do
remstart
`Control Camera
position camera 0,0,0
if mouseclick()=0
xrotate camera camera angle x()-mousemovey()*0.25
yrotate camera camera angle y()+mousemovex()*0.25
if camera angle x()>80 then xrotate camera 80
if camera angle x()<-60 then xrotate camera -60
endif
if mouseclick()>0 then CamDis#=CamDis#-mousemovey()*0.25
CamDis#=CamDis#+mousemovez()*0.25
if upkey()=1 then CamDis#=CamDis#+2.5
if downkey()=1 then CamDis#=CamDis#-2.5
if CamDis#>-20 then CamDis#=-20
if CamDis#<-300 then CamDis#=-300
move camera CamDis#
if camera position y()<-60 then position camera camera position x(),-60,camera position z()
mousemovex()=0
mousemovey()=0
`Rotate object
if KEYSTATE(19)=1 and rotate=1 and nopress=0 then rotate=0:nopress=1
if KEYSTATE(19)=1 and rotate=0 and nopress=0 then rotate=1:nopress=1
if rotate=0
rotate object 1,0,object angle y(1)+0.5,0
endif
`Change Texture
if KEYSTATE(20)=1 and nopress=0
delete image 2
inc image
if image>3 then image=1
if image=1 then load image "Media/Cube0.dds",2,2
if image=2 then load image "Media/Cube1.dds",2,2
if image=3 then load image "Media/Cube2.dds",2,2
texture object 1,1,2
texture object 2,1,2
texture object 3,0,2
nopress=1
endif
`Change Object
if Spacekey()=1 and nopress=0
delete object 1
inc object
if object>5 then object=1
if object=1 then load object "Media/t-pot.x",1:scale object 1,4000,4000,4000:scale object texture 1,4,2:object=1
if object=2 then load object "Media/Tosus.x",1:scale object texture 1,0,1.5,1
if object=3 then make object box 1,75,75,75
if object=4 then make object sphere 1,75,40,40:scale object texture 1,0,2,1
if object=5 then make object cylinder 1,75:scale object texture 1,0,3,1
texture object 1,0,1:texture object 1,1,2
set object effect 1,1
set object mask 1,2^FrameCamera
nopress=1
endif
if scancode()=0 then nopress=0
`Text
center text sw/2-text width("R - Rotate Object T - Change Texture Space - Change Object")/2,20,"R - Rotate Object T - Change Texture Space - Change Object"
center text sw/2-text width("FPS "+str$(screen fps()))/2,50,"FPS "+str$(screen fps())
remend
`Update post fiters
PostFilter_Update()
sync mask 2^0
`gosub Playercontrol
gosub playergroundalign
gosub printinfo
gosub heightcheck
`gosub camera_controls
`gosub update_camera
ox#=object position x(Object(playerid).id)
oy#=object position y(Object(playerid).id)
oz#=object position z(Object(playerid).id)
position mouse screen width()/2, screen height()/2
Text 10,10,"FPS "+str$(screen fps())
Text 10,30,"TBM Timer Speed:"+str$(screen fps()*TBM_Move(.05))
Move()
x#=object position x(Object(playerid).id)
y#=object position y(Object(playerid).id)
z#=object position z(Object(playerid).id)
UpdateLandGen()
Set Active Window GET DBPRO WINDOW()
GRAB FOCUS
UpdateGame()
if z#<>oz#
i = LookUpEnv("grassland")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("desert")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid2).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("rock")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid3).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("battlefield")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid4).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("reeds")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid5).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("scrub")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid6).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("swamp")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid7).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("forest")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid8).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("border")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid9).id
FootstepTime = timer()
endif
ENDIF
endif
`Update post fiters
PostFilter_Update()
sync mask 2^0
TBM_Update
fastsync
loop
delete object Object(playerid).id
for x=0 to 9
delete sound x
NEXT
__________INFO_________:
printinfo:
set cursor 0,50
set text opaque
print "Fps=",screen fps()
print "polygons=",statistic(1)
print "------player data-------"
print "x#=",x#
print "z#=",z#
print "angle#=",a#
print "------- ground object height data --------"
print "groundh#=",groundh#
print "groundh2#=",groundh2#
print "---------------------------"
print "W,S,A,D = drive"
print "mouse move x = turn"
print "mouse wheel = change camera distance from player"
print "R mouse + mouse move y = change camera height"
print " objsizex#=",objsizex#
print " objsizez#=",objsizez#
return
remstart
________CONTROLS__________:
Playercontrol:
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
if upkey()=1 and s#<12 then s#=s#+0.2
if downkey()=1 and s#>-12 then s#=s#-0.2
if s#>0 or s#<0 then limbrot#=wrapvalue(limbrot#+(2.4*(s#)))
if s#>0 and turn#>0 then a#=wrapvalue(a#+(s#/10*abs(turn#/20)))
if s#>0 and turn#<0 then a#=wrapvalue(a#-(s#/10*abs(turn#/20)))
if s#<0 and turn#<0 then a#=wrapvalue(a#-(s#/10*abs(turn#/20)))
if s#<0 and turn#>0 then a#=wrapvalue(a#+(s#/10*abs(turn#/20)))
if leftkey()=1 and turn#>-30 then turn#=turn#-0.8
if rightkey()=1 and turn#<30 then turn#=turn#+0.8
if leftkey()=0 and rightkey()=0 and turn#>-1.0 and turn#<1.0 then turn#=0.0
rotate limb player,3,0,-limbrot#,turn#
rotate limb player,4,0,-limbrot#,turn#
rotate limb player,1,0,-limbrot#,0
rotate limb player,2,0,-limbrot#,0
position object player,x#,groundh#,z#
yrotate object player,a#
return
remend
playergroundalign:
rem ----------------------------------------
playerfrontx#=newxvalue(x#,a#,frontoffset)
playerfrontz#=newzvalue(z#,a#,frontoffset)
playerbackx#=newxvalue(x#,a#,-rearoffset)
playerbackz#=newzvalue(z#,a#,-rearoffset)
rem ----------------------------------------
playerrightx#=x#+cos(a#)*sideoffset
playerrightz#=z#+sin(a#)*-sideoffset
playerleftx#=x#+cos(a#)*-sideoffset
playerleftz#=z#+sin(a#)*sideoffset
remstart
fronth#=get terrain ground height(1,playerfrontx#,playerfrontz#)
backh#=get terrain ground height(1,playerbackx#,playerbackz#)
righth#=get terrain ground height(1,playerrightx#,playerrightz#)
lefth#=get terrain ground height(1,playerleftx#,playerleftz#)
remend
objsizex#=object size x(Object(playerid).id)
objsizez#=object size z(Object(playerid).id)
frontoffset=int(objsizez#/2):rearoffset=frontoffset:sideoffset=int(objsizex#/2)
playerlength=int(objsizez#):playerwidth=int(objsizex#)
fronth#=10000-intersect object(Object(playerid).id,playerfrontx#,10000,playerfrontz#,playerfrontx#,-10000,playerfrontz#)
backh#=10000-intersect object(Object(playerid).id,playerbackx#,10000,playerbackz#,playerbackx#,-10000,playerbackz#)
righth#=10000-intersect object(Object(playerid).id,playerrightx#,10000,playerrightz#,playerrightx#,-10000,playerrightz#)
lefth#=10000-intersect object(Object(playerid).id,playerleftx#,10000,playerleftz#,playerleftx#,-10000,playerleftz#)
acrossheightdiff#=(righth#-lefth#)
playerangz#=atan(acrossheightdiff#/playerwidth)
alonghdiff#=backh#-fronth#
playerangx#=atan(alonghdiff#/playerlength)
rem xrotate object player,playerangx#
rotate limb Object(playerid).id,0,playerangx#,0.0,playerangz#
return
remstart
________MAKE_PLAYER____________:
make_player:
load object "tscar\tscar.x",player
set object player,1,1,0
rem yrotate object player,180
rem fix object pivot player
objsizex#=object size x(10)
objsizez#=object size z(10)
frontoffset=int(objsizez#/2):rearoffset=frontoffset:sideoffset=int(objsizex#/2)
playerlength=int(objsizez#):playerwidth=int(objsizex#)
return
remend
remstart
_________CAMERA___________:
camera_controls:
if inkey$()="<" then gosub Resetcam
if inkey$()="z" then camdist=-1000:camhgt=500:set camera range 100,40000
if mouseclick()=2
mymousey=mousemovey()
if mymousey>0 then camhgt=camhgt+3
if mymousey<0 then camhgt=camhgt-3
endif
mymousez=mousemovez()
if mymousez>0 then camdist=camdist+5
if mymousez<0 then camdist=camdist-5
if camhgt<0 then camhgt=0
return
update_camera:
ca#=wrapvalue(a#+camrot)
cx#=newxvalue(x#,ca#,camdist)
cz#=newzvalue(z#,ca#,camdist)
if groundh2#>groundh#
cy#=groundh2#
else
cy#=groundh#
endif
position camera cx#,cy#+camhgt,cz#
point camera x#,groundh#,z#
return
remend
______GROUND_CHECK________:
heightcheck:
rem check ground height at player position
groundh#=10000-intersect object(Object(playerid).id,x#,10000,z#,x#,-10000,z#)
rem check ground height at camera position
groundh2#=10000-intersect object(Object(playerid).id,cx#,10000,cz#,cx#,-10000,cz#)
return
end
function load_objects()
`PLAYER
load object "mourner.dbo",Object(playerid).id
load effect "FX/CubeMapping.fx",1,0
fix object pivot Object(playerid).id
position object Object(playerid).id,100,1,100
set object mask Object(playerid).id,2^FrameCamera : ` we want objects only rendered in frame camera
set object effect Object(playerid).id,1
global objsizex#
global objsizez#
global frontoffset#
global playerlength#
objsizex#=object size x(Object(playerid).id)
objsizez#=object size z(Object(playerid).id)
frontoffset=int(objsizez#/2):rearoffset=frontoffset:sideoffset=int(objsizex#/2)
playerlength=int(objsizez#):playerwidth=int(objsizex#)
`ENEMY
make object cube Object2(enemyid).id,1
`PLAYER HEALTH
Make Object Plain Object(obj11).id,1.25,.1
set object transparency Object(obj11).id,1
fix object pivot Object(obj11).id
position object Object(obj11).id,0,0,10
set object light Object(obj11).id,0
SET OBJECT FILTER Object(obj11).id,0
set object smoothing Object(obj11).id,100
CreateBar(Object(obj11).id,1,0,0,Object(playerid).id,0,0,100,10,Object(playerid).health#,rgbalpha(255,0,0,255),rgbalpha(255,255,0,255), Object(playerid).maxhealth#)
hide object Object(obj11).id
`PLAYER MAGIC
Make Object Plain Object(obj22).id,1.25,.1
set object transparency Object(obj22).id,1
fix object pivot Object(obj22).id
position object Object(obj22).id,0,4,2
set object light Object(obj22).id,0
SET OBJECT FILTER Object(obj22).id,0
set object smoothing Object(obj22).id,100
CreateBar(Object(obj22).id,1,0,0,Object(playerid).id,0,0,100,10,Object(playerid).magic#,rgbalpha(68,207,0,255),rgbalpha(68,207,255,255), Object(playerid).maxmagic#)
hide object Object(obj22).id
`ENEMY HEALTH
Make Object Plain Object(obj33).id,1.25,.1
set object transparency Object(obj33).id,1
fix object pivot Object(obj33).id
position object Object(obj33).id,0,0,5
set object light Object(obj33).id,0
SET OBJECT FILTER Object(obj33).id,0
set object smoothing Object(obj33).id,100
CreateBar(Object(obj33).id,1,0,0,Object2(enemyid).id,0,0,100,10,Object2(enemyid).health#,rgbalpha(255,0,0,255),rgbalpha(255,255,0,255), Object2(enemyid).maxhealth#)
hide object Object(obj33).id
endfunction
function bar(x, y, width, height, load$, P#)
P# = P#/100
if P#<0.0 then P#=0.0
rem gradient bar
seg = width / 3
box x, y, x+seg, y+height, rgb(0,0,0),rgb(0,0,0),rgb(85,0,0),rgb(85,0,0)
box x+seg, y, x+seg+seg, y+height, rgb(85,0,0),rgb(85,0,0),rgb(170,0,0),rgb(170,0,0)
box x+seg+seg, y, x+width, y+height, rgb(170,0,0),rgb(170,0,0),rgb(255,0,0),rgb(255,0,0)
rem empty bit
ink rgb(92,92,92),0
box x+width*P#, y, x+width, y+height
rem highlight
c1 = 0xCCFFFFFF
c2 = 0x33FFFFFF
box x, y, x+width, y+height*0.5, c2,c1,c2,c1
ink rgb(255,255,255)
center text x,y,load$
endfunction
Function LoadGame()
remstart
load sound "Medieval castles and ruins with medieval music 2.ogg",1
loop sound 1
remend
fog on
hide mouse
backdrop on
Color Backdrop RGB(120, 120, 120)
Autocam Off
set camera range .1, 5000
global u#
global v#
load_images(menuImage(healthtube).id,menuImage(healthbarleftside).id,menuImage(healthbarrightside).id)
Progress111("Loaded data ("+str$(int(1.0/20.0*(100.0)))+"%)",1.0/20.0)
load_objects()
Progress111("Loaded data ("+str$(int(2.0/20.0*(100.0)))+"%)",2.0/20.0)
make mesh from object 1,Object(obj11).id
Progress111("Loaded data ("+str$(int(3.0/20.0*(100.0)))+"%)",3.0/20.0)
make mesh from object 2,Object(obj22).id
Progress111("Loaded data ("+str$(int(4.0/20.0*(100.0)))+"%)",4.0/20.0)
make mesh from object 3,Object(obj33).id
Progress111("Loaded data ("+str$(int(5.0/20.0*(100.0)))+"%)",5.0/20.0)
`make vector3 Vec111(vectorid111).id
Progress111("Loaded data ("+str$(int(6.0/20.0*(100.0)))+"%)",6.0/20.0)
Progress111("Loaded data ("+str$(int(7.0/20.0*(100.0)))+"%)",7.0/20.0)
Progress111("Loaded data ("+str$(int(8.0/20.0*(100.0)))+"%)",8.0/20.0)
Progress111("Loaded data ("+str$(int(9.0/20.0*(100.0)))+"%)",9.0/20.0)
Progress111("Loaded data ("+str$(int(10.0/20.0*(100.0)))+"%)",10.0/20.0)
Progress111("Loaded data ("+str$(int(11.0/20.0*(100.0)))+"%)",11.0/20.0)
Progress111("Loaded data ("+str$(int(12.0/20.0*(100.0)))+"%)",12.0/20.0)
Progress111("Loaded data ("+str$(int(13.0/20.0*(100.0)))+"%)",13.0/20.0)
Progress111("Loaded data ("+str$(int(14.0/20.0*(100.0)))+"%)",14.0/20.0)
Progress111("Loaded data ("+str$(int(15.0/20.0*(100.0)))+"%)",15.0/20.0)
Progress111("Loaded data ("+str$(int(16.0/20.0*(100.0)))+"%)",16.0/20.0)
Progress111("Loaded data ("+str$(int(17.0/20.0*(100.0)))+"%)",17.0/20.0)
Progress111("Loaded data ("+str$(int(18.0/20.0*(100.0)))+"%)",18.0/20.0)
Progress111("Loaded data ("+str$(int(19.0/20.0*(100.0)))+"%)",19.0/20.0)
Progress111("Loaded data ("+str$(int(20.0/20.0*(100.0)))+"%)",20.0/20.0)
it=1
if it
set text font "MS Gothic"
set text size 10
set text to bold
it=0
endif
loaded = 1
EndFunction
function UpdateGame()
xrotate object Object(playerid).id,wrapvalue(object angle x(Object(playerid).id)+mousemovey()/2.0*TBM_Move(.01))
yrotate object Object(playerid).id,wrapvalue(object angle y(Object(playerid).id)+mousemovex()/2.0*TBM_Move(.01))
remstart
if keystate(17) or upkey() or mouseclick()=1 then move object Object(playerid).id,7*TBM_Move(.01)
if keystate(31) or downkey() or mouseclick()=2 then move object Object(playerid).id,-7*TBM_Move(.01)
if keystate(30) or leftkey() then dec ang#,7*TBM_Move(.01)
if keystate(32) or rightkey() then inc ang#,7*TBM_Move(.01)
if ang#>360 then ang#=0
if ang#<-360 then ang#=0
`position object Sky(skyid).id,object position x(Object(playerid).id),object position y(Object(playerid).id),object position z(Object(playerid).id)
`Player 1's co-ordinates
X1# = object position x(Object(playerid).id)
Y1# = object position y(Object(playerid).id)
Z1# = object position z(Object(playerid).id)
Angle1# = object angle y(Object(playerid).id)
`Player 1's movement
`If upkey() = 1 or keystate(17) then Move object Object(playerid).id, .1
`If downkey() = 1 or keystate(31) then Move object Object(playerid).id, -.1
`If leftkey() = 1 or keystate(30) then Dec Angle1#, 1
`If rightkey() = 1 or keystate(32) then Inc Angle1#, 1
Rotate object Object(playerid).id, 0, ang#+Angle1#, 0
`rotate object Landscape(terrainpiv).piv,0,object angle y(Object(playerid).id),0
Set camera to follow X1#, Y1#, Z1#, Angle1#, 40, 4, 9, 1
remend
`if object visible(Object(playerid).id)
if keystate(44) and (Object(playerid).health# > 0.0)
dec Object(playerid).health#,100
if Object(playerid).health#>Object(playerid).maxhealth#
Object(playerid).health#=Object(playerid).maxhealth#
endif
endif
if keystate(45) and (Object(playerid).health# < Object(playerid).maxhealth#)
inc Object(playerid).health#,100
if Object(playerid).health#<0
Object(playerid).health#=0
endif
endif
`endif
if GetDist(0,0,Object(playerid).id,Object2(enemyid).id)<10 and GetDist(1,0,Object(obj11).id,0)>1.6
Show Object Object(playerid).id
Show Object Object(obj11).id
Show Object Object(obj22).id
Show Object Object(obj33).id
else
hide Object Object(obj11).id
hide Object Object(obj22).id
hide Object Object(obj33).id
endif
CreateBar(Object(healthbarid).id,0,0,10,menuImage(healthbar).id,0,0,100,10,Object(playerid).health#,rgbalpha(255,0,0,255),rgbalpha(255,255,0,255),Object(playerid).maxhealth#)
CreateBar(Object(magicbarid).id,0,0,0,menuImage(magicbar).id,0,20,100,10,Object(playerid).magic#,rgbalpha(68,207,0,255),rgbalpha(68,207,255,255),Object(playerid).maxmagic#)
text 10,50,"y:"+str$(object angle y(Object(playerid).id))
ENDFUNCTION
FUNCTION Progress111(t$,prog#)
if prog#>100.0 then prog#=100.0
prog_x=(screen width()/2)-128
prog_y=(screen height()/2)
ink rgb(255,255,255),0
center text prog_x+128,prog_y-16,t$
ink rgb(16,16,16),0
box prog_x-1,prog_y-1,prog_x+257,prog_y+17
`ink rgb(255,16,16),0
box prog_x-1,prog_y-1,prog_x+1+(prog#*256),prog_y+17,rgb(255,0,0),rgb(0,255,0),rgb(0,0,255),rgb(255,0,255)
sync
ENDFUNCTION
function round(n#,r)
n#= n#/r
n= int(n#+n#)-int(n#)
n= n*r
endfunction n
function load_images(id1,id2,id3)
load image "tube8.png", id1
load image "circle.png", id2
load image "circle.png", id3
endfunction
function rgbalpha(r,g,b,a)
c = (a and 0xff) << 24 or ((r and 0xff) << 16) or ((g and 0xff) << 8) or (b and 0xff)
endfunction c
function CreateBar(theobj,twodorthreed,posx=0,posy=0,id,x,y,width,height,P#,c1,c2,max#)
if bitmap exist(id)=0
CREATE BITMAP id,width,height
endif
set current bitmap id
P# = P#/max#
if P#<0.0 then P#=0.0
rem gradient bar
seg = width / 3
box x, y, x+seg, y+height, c2,c1,c2,c1
box x+seg, y, x+seg+seg, y+height, c2,c1,c2,c1
box x+seg+seg, y, x+width, y+height, c2,c1,c2,c1
` box x, y, x+seg, y+height, rgbalpha(255,0,0,255),rgbalpha(255,0,0,255),rgbalpha(170,85,0,255),rgbalpha(170,85,0,255)
` box x+seg, y, x+seg+seg, y+height, rgbalpha(170,85,0,255),rgbalpha(170,85,0,255),rgbalpha(85,170,0,255),rgbalpha(85,170,0,255)
` box x+seg+seg, y, x+width, y+height, rgbalpha(85,170,0,255),rgbalpha(85,170,0,255),rgbalpha(0,255,0,255),rgbalpha(0,255,0,255)
` rem empty bit
` ink rgb(92,92,92),0
` box x+width*P#, y, x+width, y+height
rem highlight
box x, y, x+width, y+height*0.5, c2,c1,c2,c1
ink rgb(255,255,255),0
center text width/2,0,getnumber(int(P#*max#))+"/"+getnumber(int(max#))
if twodorthreed=0
GET IMAGE id,0,0,width,height,1
set current bitmap 0
paste image id,posx,posy
else
GET IMAGE id,0,0,width,height,1
set current bitmap 0
if object exist(obj11)
texture object obj11,id
else
exitfunction
endif
endif
endfunction
function getnumber(num)
n$=str$(num)
if num>999
n=num/1000
if n>999
m=n/1000
leng=len(str$(m))
re$=mid$(n$,leng+1)+mid$(n$,leng+2)
re$=mid$(n$,2)+mid$(n$,3)
r#=val(re$)
if r#>0.0
re$="."+re$
else
re$=""
endif
s$=str$(m)+re$+"M"
else
leng=len(str$(n))
re$=mid$(n$,leng+1)+mid$(n$,leng+2)
r#=val(re$)
if r#>0.0
re$="."+re$
else
re$=""
endif
s$=str$(n)+re$+"K"
endif
else
s$=str$(num)
endif
endfunction s$
function glue_object_to_object(a,b)
`get start and end point offsets
`start point
EZro_ObjFindOffsetFromPoint b, object position x(a),object position y(a),object position z(a)
x1#=EZro_GetOffsetX()
y1#=EZro_GetOffsetY()
z1#=EZro_GetOffsetZ()
`end point
move object a, 1
EZro_ObjFindOffsetFromPoint b, object position x(a),object position y(a),object position z(a)
x2#=EZro_GetOffsetX()
y2#=EZro_GetOffsetY()
z2#=EZro_GetOffsetZ()
`position child
position object a, x1#,y1#,z1#
`point at end point
point object a, x2#,y2#,z2#
`glue to main limb
glue object to limb a, b, 0
endfunction
function GetDist(camon,cam,myobj1,myobj2)
select camon
case 0
if myobj1<>0 and myobj2<>0
x1#=Object Position X(myobj2)
y1#=Object Position Y(myobj2)
z1#=Object Position Z(myobj2)
x2#=Object Position X(myobj1)
y2#=Object Position Y(myobj1)
z2#=Object Position Z(myobj1)
endif
endcase
case 1
if myobj1<>0
x1#=Camera Position X(cam)
y1#=Camera Position Y(cam)
z1#=Camera Position Z(cam)
x2#=Object Position X(myobj1)
y2#=Object Position Y(myobj1)
z2#=Object Position Z(myobj1)
endif
endcase
endselect
dist# = FML Distance(x1#,y1#,z1#,x2#,y2#,z2#)
endfunction dist#
function get_dx(ver)
version = windows version()
dir$=DIR SYSTEM()+"\"
select ver
case 9
if file exist(dir$+"d3dx9_24.dll")=0 or file exist(dir$+"d3dx9_25.dll")=0 or file exist(dir$+"d3dx9_26.dll")=0 or file exist(dir$+"d3dx9_27.dll")=0 or file exist(dir$+"d3dx9_28.dll")=0 or file exist(dir$+"d3dx9_29.dll")=0 or file exist(dir$+"d3dx9_30.dll")=0 or file exist(dir$+"d3dx9_31.dll")=0 or file exist(dir$+"d3dx9_32.dll")=0 or file exist(dir$+"d3dx9_33.dll")=0 or file exist(dir$+"d3dx9_34.dll")=0 or file exist(dir$+"d3dx9_35.dll")=0 or file exist(dir$+"d3dx9_36.dll")=0 or file exist(dir$+"d3dx9_37.dll")=0 or file exist(dir$+"d3dx9_38.dll")=0 or file exist(dir$+"d3dx9_39.dll")=0 or file exist(dir$+"d3dx9_40.dll")=0 or file exist(dir$+"d3dx9_41.dll")=0 or file exist(dir$+"d3dx9_42.dll")=0 or file exist(dir$+"d3dx9_43.dll")=0
center text screen width()/2, screen height()/2, "PLEASE download directx 9.0c!"
center text screen width()/2, screen height()/2+20, str$(version)
center text screen width()/2, screen height()/2+40, dir$
sync
wait key
ENDIF
endcase
case 10
`if file exist(dir$+"d3dx10.dll")=0 or file exist(dir$+"d3dx10_33.dll")=0 or file exist
`center text screen width()/2, screen height()/2, "PLEASE download directx 10!"
`center text screen width()/2, screen height()/2+20, str$(version)
`center text screen width()/2, screen height()/2+40, dir$
`sync
`wait key
`ENDIF
endcase
endselect
ENDFUNCTION
thanks guys!
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/