Please can some 1 help me. I made a programme in QBASIC the other day where boxes bounced of each other because of the pixel colour using the point command. Eg if not bakcolour (checking 8 points on a square, corners and middle edges,) then bounce. I tried to replicate this in DB but the point does not return sprite colour. Why???? I do not know. Perhaps its the way DB is programmed but I think a command description should actually do what it says eg
Point command:
"This command will return the pixel color value from the screen at the specified Coordinates. The
parameters should be specified using integer values. You can also read from bitmaps by using the SET CURRENT BITMAP command." - Please fix in next patch.
O from the screen eh? Well where is the invisable text that states only really return crap.
How else am I supposed to check which side of the box has been hit if not with the point command.
Any here is my snippet please add two of you own texture files to make work.
cls
set display mode 640,480,32
show mouse
autocam off
sync rate 1000
load image "floor2.jpg",1
load image "floor.jpg",2
color backdrop 23465435
backdrop on
draw to front
y = 50
x = 400
y2 = 1
x2 = 200
up = 0
right = 0
up2 = 0
right2 = 0
do
sprite 1,x,y,1
sprite 2,x2,y2,2
gosub moveboxes
if mouseclick() then gosub dis
gosub hit
set cursor 0,0
print leftside,rightside,topmid,botmid
set cursor 0,20
print leftside2,rightside2,topmid2,botmid2
sync
loop
dis:
ink rgb(255,255,255),0
set cursor mousex()+20 , mousey()
print point (mousex()-2,mousey()-2)
return
hit:
`left mid
leftside = point(x - 2 ,y+sprite height(1)/2)
`right mid
rightside = point (sprite width(1) + 2 ,y + sprite height(1)/2)
` top mid
topmid = point (x + sprite width(1)/2 ,y - 2)
`bootom mid
botmid = point (x + sprite width(1)/2 ,y+sprite height(1)+2)
`left mid
leftside2 = point(x2 - 2 ,y2+sprite height(2)/2)
`right mid
rightside2 = point (sprite width(2) +2 ,y2+sprite height(2)/2)
` top mid
topmid2 = point (x2 + sprite width(2)/2 ,y2 - 2)
`bootom mid
botmid2 = point (x2 + sprite width(2)/2 ,y2+sprite height(2)+2)
return
moveboxes:
select up
case 0
y=y +1
if y >= 480-sprite height(1) then up = 1
endcase
case 1
y=y-1
if y = 640- sprite width(1) then right = 0
endcase
endselect
select up2
case 0
y2=y2 +1
if y2 >= 480 -sprite height(2) then up2 = 1
endcase
case 1
y2=y2-1
if y2 = 640 - sprite width(2) then right2 = 0
endcase
endselect
return
Here is my really good qbasic version
use arrow keys:
http://www.geocities.com/pugh2317/ESCTHEBALLS.zipThe Universe has infinate possibilities. So do YOU!