Punch holes in a cube in realtime! Each time you click the mouse
a hole is punched in your cheese. This could be helpful in a shooter
where you want to shoot holes in a wall.
With some improvements it should be possible to shoot the holes where your weapon points. But as a proof of concept. This shows it is possible to do in DBC & DBP
remstart
Punch holes in a cube in realtime! Each time you click the mouse
a hole is punched in your cheese
(c) 2008 Attila
remend
backdrop on
randomize timer()
color backdrop rgb(128,128,255)
cls
sync on
make object cube 1,6
MakeTexture(1)
texture object 1,1
remstart
Activate this commands for DBpro
remend
set object transparency 1,1
set object cull 1,0
remstart
Activate this command for DBC
remend
`set object 1, 1,0,0
position camera 0,8,-20
point camera 0,0,0
r#=0
do
if mouseclick() = 1
AddHole(1)
texture object 1,1
while mouseclick() : sync : endwhile
endif
r#=wrapvalue(r#+.1)
yrotate object 1,r#
sync
loop
function AddHole(Nr)
set current bitmap nr
ink rgb(0,0,0),0
x=rnd(100)+20
y=rnd(100)+20
r1#=0
for h=0 to 18
circle x,y,r1#
r1#=r1#+.5
next h
box x-5,y-5,x+5,y+5
get image nr,0,0,128,128
set current bitmap 0
endfunction 0
function MakeTexture(nr)
create bitmap nr,128,128
set current bitmap nr
ink rgb(255,255,0),0
box 1,1,127,127
ink rgb(64,64,128),0
for h=1 to 100
x=rnd(126)
y=rnd(126)
box x,y,x+1,y+1
next h
get image nr,0,0,128,128
set current bitmap 0
endfunction 0