Quote: "For me, the sprite hit command works for images loaded, but not image that were captured with get image."
The sprite hit works with sprites, and sprites alone, either their image was captured or loaded.
Oh, and i found out why is it that it doesn't work. Your background is a sprite, right?.... so "sprite hit(2, 0)" will always return 1 as its the backgroung sprite. Replace the background with a pasted image, like this...
Rem Created: 10/4/2006 6:07:01 PM
Rem ***** Main Source File *****
rem start the syncing
sync on
sync rate 100
hide mouse
rem all the media besides the backdrop is in a single file
load image "Pieces.bmp", 1, 1
paste image 1, 0, 0
set image colorkey 255, 0, 255
rem get the ball image
get image 2, 43, 145, 57, 159, 1
rem get the paddle image
get image 3, 0, 163, 57, 173, 1
rem get the tiles
local tile as integer
local coordinate as integer
for tile = 4 to 10
get image tile, 0, coordinate, 41, coordinate + 18, 1
inc coordinate, 18
next tile
rem we're done with the main media file, now we need to load the backdrop
delete image 1
load image "Backdrop.bmp", 1, 1
rem set up the game
sprite 2, 100, 100, 2
set sprite 2, 0, 1
offset sprite 2, 6, 6
sprite 3, 0, 400, 3
set sprite 3, 0, 1
rem make all the blocks
local block as integer
local color as integer
block = 4
for color = 4 to 10
for tile = 1 to 15
sprite block, (tile * 41) - 28.5, color * 18, color
inc block
next tile
next color
local ball_x_momentum as float
local ball_y_momentum as float
ball_x_momentum = 5
ball_y_momentum = 5
do
paste image 1,0,0
rem move the ball
sprite 2, sprite x(2) + ball_x_momentum, sprite y(2) + ball_y_momentum, 2
rem if the ball hits the ceiling, make it bounce
if sprite y(2) + sprite height(2) / 2 >= 480 or sprite y(2) - sprite height(2) / 2 <= 0 then ball_y_momentum = -ball_y_momentum
rem if the ball hits the wall, make it bounce
if sprite x(2) + sprite width(2) / 2 >= 640 or sprite x(2) - sprite width(2) / 2 <= 0 then ball_x_momentum = -ball_x_momentum
rem if the ball hits the paddle, make it bounce
if sprite hit(2, 3) then ball_y_momentum = -ball_y_momentum
rem if the ball hits a block, make it bounce
block = sprite hit(2, 0)
if block > 3 then delete sprite block
rem move the paddle
sprite 3, mousex(), 400, 3
if sprite x(3) + sprite width(3) > 640 then sprite 3, 640 - sprite width(3), 400, 3
sync
loop
It now works fine for me, just take a look at the attached pic.
Further on my stuff at...
