that's pretty much what i'm doing except all i get is the plain(no pun intended) texture
what i'm doing is taking my animation placing it in the upper right corner of the screen the grabbing a image of it's current frame. and then texturing my plain with the image, then seting my plain to transparency...but all i get is a the plain texture (instead of the parts i want to be invisible being invisible...
)
here's my source if it will help you any...(note: will not run without media)
hide mouse
sync on
sync rate 60
center text screen width()/2,screen height()/2,"Loading..."
sync
rem SOME globals to make (SetCollisions) and ray-cast
rem statements easier to read
#Constant TYPE_NGC_ELLIP=1
#Constant TYPE_NGC_MESH=2
#Constant ELLIP_2_ELLIP=1
#Constant ELLIP_2_POLY=2
#Constant RESP_STICK=1
#Constant RESP_SLIDE=2
#Constant RESP_SLIDE_NO_SLOPES=3
#Constant RESP_SLIDE_NO_GRAV=4
#Constant RESP_NONE=5
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_LOCK=3
#Constant DYN_RESP_LOCK_NOTURN=4
rem End globals
StartCollisionPRO(737452718,148672131,581655328)
type_player=1
type_world=2
type_npcs=3
SetCollisionsPro( TYPE_PLAYER, TYPE_WORLD, ELLIP_2_POLY, RESP_SLIDE_NO_GRAV, DYN_RESP_LOCK )
SetCollisionsPro( TYPE_PLAYER, TYPE_ENEMY, ELLIP_2_ELLIP, RESP_SLIDE, DYN_NO_RESP )
SetCollisionsPro( TYPE_PLAYER, TYPE_FREE_CAM, ELLIP_2_ELLIP, RESP_SLIDE, DYN_NO_RESP )
load sound "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Sounds\Space guns\White zap.wav",1
load sound "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Sounds\Guns\Automatic loop.wav",2
load sound "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Sounds\Guns\Automatic reload.wav",3
load image "C:\Program Files\Dark Basic Software\Dark Basic Professional\Media\Textures\concrete_T.BMP",1
load image "C:\Documents and Settings\Connie\My Documents\My Pictures\Pete's Stuff\Exp.jpg",2
load animation "media/fizz.avi",1
load image "Media\breadpan_sq.bmp",3
inc numofobjects
make object plain 666,2,8
texture object 666,2
set image colorkey 255,255,255
set object transparency 666,1
hide object 666
`make "colission box" for the FPS camera
player=1
inc numofobjects
make object box player,7,20,7
hide object player
position object player,10,5,10
CollisionTypePRO(player,type_Player)
SetObjRadiusPRO(player,7,20,7)
SetObjGravityPRO(player,2.5)
`gun }:>
inc numofobjects
load object "Media\Pistol.x",4
yrotate object 4,-90
texture object 4,3
position object 4,5,-5,10
lock object on 4
inc numofobjects
load object "C:\Program Files\Dark Basic Software\Tutorials\dbp_demo_pack\media\3rd_shooter\dbp_demo_level.x",3
CollisionTypePro(3,type_world)
remstart
load image "media/bullet hole.bmp",20,1
for t=1000 to 1050
make object plain t,2,2
texture object t,20
set object transparency t,1
hide object t
next t
remend
`make "shootable" object
inc numofobjects
make object cube 10,10
position object 10,object position x(1),object position y(1)+5,object position z(1)
texture object 10,1
collisiontypePRO(10,type_world)
rem loads the lazer sight for the walls
inc numofobjects
global lzr = 20
make object plain lzr, 3, 3
load image "C:\Program Files\Dark Basic Software\Tutorials\dbp_demo_pack\media\3rd_shooter\player\lazer_sight.png", lzr
texture object lzr, lzr
set object transparency lzr, 1
set object light lzr, 0
`make the bullet objects
for currentbulletid=2001 to 2050
make object plain currentbulletid,5,5
set object transparency currentbulletid,1
set object currentbulletid,1,0,1
ghost object on currentbulletid,1
next currentbulletid
global jumping
global cameray#
global camerax#
global droplength
global player=1
global speed as float
global currentbulletid=2001
global holdmouse
global holdrightmouse
global nextburst
ammo=250
clips=10
loop animation 1
do
update_player(1)
update_shooting()
update_bullets()
RunCollisionPRO()
text 0,700,"Ammo in clip: "+str$(ammo)+" Clips: "+str$(clips)
sync
loop
rem Player function
function Update_player(ID)
length=25
speed=speed*.90
inc cameray#,mousemovex()
inc camerax#,mousemovey()
if camerax#>80 then camerax#=80
if camerax#<-90 then camerax#=-90
yrotate camera 0,cameray#/2
xrotate camera 0,camerax#/2
if jumping=0
droplength=droplength+1
endif
if jumping=0 and spacekey()=1 and droplength>40
jumping=1
speed=10
droplength=0
endif
if jumping>0
inc jumping
posx#=object position x(id)
posy#=object position y(id)
posz#=object position z(id)
position object id,posx#,posy#+speed,posz#
endif
if jumping=>length
jumping=0
endif
if keystate(17)=1 then move object id,2
if keystate(31)=1 then move object id,-2
if keystate(30)=1
oldx=object angle y(id)
newx=wrapvalue(oldx-90)
yrotate object id,newx
move object id,1
yrotate object id,oldx
endif
if keystate(32)=1
oldy=object angle y(id)
newy=wrapvalue(oldy+90)
yrotate object id,newy
move object id,1
yrotate object id,oldy
endif
posx#=object position x(id)
posy#=object position y(id)
posz#=object position z(id)
yrotate object id,camera angle y()
position camera posx#,posy#+8,posz#
endfunction
function update_bullets()
for i=2001 to 2050
move object i,5
if object hit(i,0)>0 then position object i,0,-1000,0
set image colorkey 0,0,0
texture object i,4
set object transparency i,1
next i
endfunction
function make_plasma_bullet(id)
inc currentbulletid
if currentbulletid>2050 then currentbulletid=2001
play sound 1
Laser_x# = newxvalue(Camera position x(), wrapvalue(camera angle y()+90), 1)
Laser_z# = newzvalue(Camera position z(), wrapvalue(camera angle y()+90), 1)
position object currentbulletid, Laser_x#, Camera position y()-1, Laser_z#
rotate object currentbulletid,camera angle x(),camera angle y(),camera angle z()
endfunction
rem Handles our lazer sight
function Update_shooting()
place animation 1,0,0,10,10
set image colorkey 0,0,0
get image 4,0,0,5,5,1
`place animation 1,-5,-5,0,0
`for testing
guntype=1
if guntype=1
if mouseclick()=1 and holdmouse>10 and holdrightmouse>60 and nextburst<0
make_plasma_bullet(4)
holdmouse=1
endif
if mouseclick()=2 and holdrightmouse>60 and holdmouse>10 and nextburst<0
make_plasma_bullet(4)
nextburst=10
holdrightmouse=1
endif
if nextburst=5
make_plasma_bullet(4)
endif
if nextburst=0
make_plasma_bullet(4)
endif
if mouseclick()=0
inc holdmouse
inc holdrightmouse
endif
dec nextburst
if nextburst<-1000 then nextburst=-1
endif
rem Get the positions of the player object
player_x# = object position x(player) : player_y# = object position y(player) : player_z# = object position z(player)
rem Store the start positions and increase the Y pos so sy# reflects the
rem the Y position of the gun
sx# = player_x#+5
sy# = player_y#-5
sz# = player_z#+10
rem Set the lzr decal object to the orienation of the player
set object to object orientation lzr, player
rem position the lzr at the start positions
position object lzr, sx#, sy#, sz#
rem turn it left 90 degrees
turn object left lzr, 90
rem move it forward 5 degrees
move object lzr, 5
rem turn it back right 90 degrees
turn object right lzr, 90
rem set start positions to object position of lzr object
sx# = object position x(lzr)
sy# = object position y(lzr)
sz# = object position z(lzr)
rem move our lzr object forward 500 units
move object lzr, 500
rHit# = 500
rem store it's new position the end position variables
ex# = object position x(lzr) : ey# = object position y(lzr) : ez# = object position z(lzr)
rem Cast a ray from the lzr start position to it's end position
rem Test against world objects, and test them as mesh objects
bHit = RayIntersectTypePRO(TYPE_WORLD, TYPE_NGC_MESH, sx#, sy#, sz#, ex#, ey#, ez#)
rem if the ray hit something
if bHit = 1
rem Gets the positions the ray intersected the object
hitX# = RayHitPosPRO("X")
hitY# = RayHitPosPRO("Y")
hitZ# = RayHitPosPRO("Z")
rem Gets the normals of the surface that was intersected
hitNX# = RayHitNormPRO("X",0)
hitNY# = RayHitNormPRO("Y",0)
hitNZ# = RayHitNormPRO("Z",0)
rem Passing the normals in, get the Y angle we need to rotate our decal object
yrot# = Vec2YawPRO(hitNX#, hitNY#, hitNZ#)
rem Passing the normals in, get the pitch we need to adjust the decal by
pitch# = Vec2PitchPRO(hitNX#, hitNY#, hitNZ#)
rem Push the hit positions away from the surface a bit
hitX# = hitX# + (hitNX# * 0.20)
hitY# = hitY# + (hitNY# * 0.20)
hitZ# = hitZ# + (hitNZ# * 0.20)
rem rotate the object to 0,0,0 (this should always be done before using the
rem next commands)
rotate object lzr, 0, 0, 0
rem Rotate the decal into position
yrotate object lzr, yrot#
pitch object up lzr, pitch#
rem Position the decal at the final hit positions
position object lzr, hitX#, hitY#, hitZ#
rem gets the distance of the ray-intersection
rHit# = RayHitDistPRO()
endif
rem Cast a ray from the lzr start position to it's end position
rem Test against enemy objects, and tests them as ellipsoids
bHit = RayIntersectTypePRO(TYPE_ENEMY, TYPE_NGC_ELLIP, sx#, sy#, sz#, ex#, ey#, ez#)
if bHit = 1
rem if the distance to hit is less than the previous hit distance for the last test
if RayHitDistPRO() < rHit#
rem gets the distance of the ray-intersection
rHit# = RayHitDistPRO()
rem Gets the positions the ray intersected the object
hitX# = RayHitPosPRO("X")
hitY# = RayHitPosPRO("Y")
hitZ# = RayHitPosPRO("Z")
rem Gets the normals of the surface that was intersected
hitNX# = RayHitNormPRO("X",0)
hitNY# = RayHitNormPRO("Y",0)
hitNZ# = RayHitNormPRO("Z",0)
rem Passing the normals in, get the Y angle we need to rotate our decal object
yrot# = Vec2YawPRO(hitNX#, hitNY#, hitNZ#)
rem Passing the normals in, get the pitch we need to adjust the decal by
pitch# = Vec2PitchPRO(hitNX#, hitNY#, hitNZ#)
rem Push the hit positions away from the surface a bit
hitX# = hitX# + (hitNX# * 0.20)
hitY# = hitY# + (hitNY# * 0.20)
hitZ# = hitZ# + (hitNZ# * 0.20)
rem rotate the object to 0,0,0 (this should always be done before using the
rem next commands)
rotate object lzr, 0, 0, 0
rem Rotate the decal into position
yrotate object lzr, yrot#
pitch object up lzr, pitch#
rem Position the decal at the final hit positions
position object lzr, hitX#, hitY#, hitZ#
endif
endif
endfunction
remstart
paste_bullet_holes:
if Firing=1
if lasthole=1050 then lasthole=1000 else lasthole=lasthole+1
position object lasthole,RayHitPosPRO(x),RayHitPosPRO(y),RayHitPosPRO(z)
normX#=RayHitNormPRO(x,0)+object position x(lasthole)
normY#=RayHitNormPRO(y,0)+object position y(lasthole)
normZ#=RayHitNormPRO(z,0)+object position z(lasthole)
point object lasthole,normX#,normY#,normZ#
show object lasthole
endif
return
remend
i have tried setting the colorkey...but to no avail
here's a screenie of the disgusting plain...
as you can see all black except for a hint of grey(wich may come from lighting
)
Formerly known as "DarkWing Duck"