I guess I can't edit my previous post. Here is the code and image.
REM Project: rednose
REM Created: 2/18/2007 7:49:17 AM
REM
REM ***** Main Source File *****
REM
`define the sprite structure
type SPRITET
x as integer `col or horizontal pos
y as integer `row or vertical pos
speedx as integer `horizontal speed
speedy as integer `vertical speed
alpha as integer
endtype
global ball as SPRITET
global net as spritet
global SpriteHit as byte
global net_hit_x as integer
global net_hit_y as integer
global ball_hit_x as integer
global ball_hit_y as integer
sync on
sync rate 40
hide mouse
set image colorkey 250,78,229
`load the background image
load image "sc_640.bmp", 100
load image "butterfly_net_big_orig.bmp", 1
load image "ball.bmp", 2
` Set the mouse cursor spite
SPRITE 1,320,240,1
SET SPRITE 1,1,1
sprite 2, 999, 999, 2
`speed of ball
ball.speedx = 2
ball.speedy = 2
set sprite priority 1,1
`main game loop
repeat
`-------------------------------------------
'this is so I can start the game over without ending it
if mouseclick() = 2
spritehit = 0
endif
`-------------------------------------------
`draw the background
paste image 100, 0, 0
move_net()
move_ball()
if spritehit
`this is for testing positions
ink rgb(0,0,0),0
text 10,10,"net_hit_x = " + str$(net_hit_x)
text 10,25,"net_hit_y = " + str$(net_hit_y)
text 10,40,"ball_hit_x = " + str$(ball_hit_x)
text 10,55,"ball_hit_y = " + str$(ball_hit_y)
endif
sync
until spacekey()
end
function move_ball()
local w as integer
local h as integer
if spritehit
exitfunction
endif
`update the ball's X pos
w = screen width() - sprite width(2)
ball.x = ball.x + ball.speedx
if ball.x > w or ball.x < 0
ball.speedx = ball.speedx * -1
ball.x = ball.x + ball.speedx
endif
`update the ball's y pos
h = screen height() - sprite height(2)
ball.y = ball.y + ball.speedy
if ball.y > h or ball.y < 0
ball.speedy = ball.speedy * -1
ball.y = ball.y + ball.speedy
endif
`draw the ball
sprite 2, ball.x, ball.y, 2
endfunction
function move_net()
` local x as integer
` local y as integer
` x = screen width() - sprite width(1)
` y = screen height() - sprite height(1)
SPRITE 1, MOUSEX(), MOUSEY(), 1
IF MOUSECLICK()=1
` notice this is not sprite collision but sprite hit
IF SPRITE hit(1,2) `I tried reversing the sprites - didn't think that would work
`just info to be printed out
net_hit_x = mousex()
net_hit_y = mousey()
ball_hit_x = ball.x
ball_hit_y = ball.y
`this is the variable to indicate if there was a hit or not in case I need to do more
SpriteHit = 1
ENDIF
ENDIF
endfunction
As opposed to Highlander.