Not sure if this will be useful to anyone or not. Click anywhere on the screen. The mouse coordinates are translated to the texture image size, and then a bullet hole image is applied to the texture image of the plains.
sorry for the sloppy, disorganized code. its just one of many image memblock things i've been playing with during the night.
screenwidth = 800
screenheight = 600
set display mode screenwidth,screenheight,32
load image "clouds.bmp", 1, 1
rem 16x16 image
load image "bullet hole.bmp", 5, 1
make memblock from image 2, 5
make memblock from image 1, 1
width as dword
height as dword
depth as dword
GLOBAL width
width = memblock dword(1,0)
height = memblock dword(1,4)
depth = memblock dword(1,8)
size = get memblock size(1)
width2 as dword
height2 as dword
depth2 as dword
GLOBAL width2
width2 = memblock dword(2,0)
height2 = memblock dword(2,4)
depth2 = memblock dword(2,8)
size2 = get memblock size(2)
make image from memblock 2, 1
sync on
autocam off
backdrop on
position camera 0,0,0
make object plain 1, 128,128
position object 1, -50,0,400
texture object 1, 1
make object plain 2, 128,128
position object 2, 100,0,400
texture object 2,1
do
if mouseclick()=1 and click = 0
click = 1
fx = mousex()/(screenwidth/width) + 1
fy = mousey()/(screenheight/height) + 1
location = gridToSingle(fx, fy)* 4 + 12
w = width2/2
for x = 1 to width2
for y = 1 to height2
location = gridToSingle2(x,y)*4 + 12
b = memblock byte(2,location)
g = memblock byte(2,location+1)
r = memblock byte(2,location+2)
if fx-(x-w) >= 1 and fx-(x-w) <= width and fy-(y-w) >= 1 and fy-(y-w) <= height
if r<>0 and g<>0 and b<>0
location = gridToSingle(fx-(x-w), fy-(y-w))*4 + 12
write memblock dword 1, location, rgb(r,g,b)
endif
endif
next y
next x
make image from memblock 1,1
endif
if mouseclick()=0 then click = 0
if mouseclick()=2
fx = mousex()/8 + 1
fy = mousey()/6 + 1
location = gridToSingle(fx, fy)* 4 + 12
write memblock dword 1, location, rgb(125,150,0)
make image from memblock 1, 1
endif
if spacekey() and key = 0
key = 1
inc blue
for x = 1 to 200
for y = 1 to 200
location = gridToSingle(x,y)*4 + 12
b = memblock byte(1,location)*1.1
g = memblock byte(1,location+1)*1.1
r = memblock byte(1,location+2)*1.1
if b > 255 then b = 255
if g > 255 then g = 255
if r > 255 then r = 255
`write memblock byte 1, location, blue
write memblock dword 1, location, rgb(r,g,b)
next y
next x
make image from memblock 1, 1
endif
if spacekey()=0 then key = 0
if shiftkey() and key2 = 0
key2 = 1
for x = 1 to 200
for y = 1 to 200
location = gridToSingle(x,y)*4 + 12
b = memblock byte(1,location)*0.9
g = memblock byte(1,location+1)*0.9
r = memblock byte(1,location+2)*0.9
if b < 0 then b = 0
if g < 0 then g = 0
if r < 0 then r = 0
`write memblock byte 1, location, blue
write memblock dword 1, location, rgb(r,g,b)
next y
next x
make image from memblock 1, 1
endif
if shiftkey()=0 then key2 = 0
a# = wrapvalue(a#+0.1)
zrotate object 2, a#
set cursor 0,0
print "width - ",width
print "height - ",height
print "depth - ",depth
print "size - ",size
print
print "width - ",width2
print "height - ",height2
print "depth - ",depth2
print "size - ",size2
print
print screen fps()
print r
print g
print b
sync
loop
function gridToSingle(x as integer, y as integer)
thing = (y-1)*width + x - 1
endfunction thing
function gridToSingle2(x as integer, y as integer)
thing = (y-1)*width2 + x - 1
endfunction thing
and here's the images used:
http://www.dannywartnaby.co.uk/rgt/attachments/images12321.zip
"eureka" - Archimedes