Is there a decent string of code that performs sprite detection/collision?
The problem is, in my game, when using 3x3+ enemies, both
sprite_colliding
and
if c?? sprite p?? ('spr?_x') ('spr?_y') "blah"
either have a severe delay or only recognize the x or the y coordinates (i.e. if the enemy is several points above you, if you cross their same y axis, the command will be triggered)
What coding does everyone else use for collision/detection?
Page 1 of 1
Sprite Collision
#2
Posted 07 February 2007 - 01:28 AM
Quote
set "spr0_refx" to 30
set "spr0_refy" to 25
set "spr0_width" to 3
set "spr0_height" to 3
set "spr0_cwidth" to 3
set "spr0_cheight" to 3
put c?? sprite p00 at 0 0
: "l"
if c?? Sprite_colliding p00 at 0 0 "collision"
wait for 1
goto "l"
set "spr0_refy" to 25
set "spr0_width" to 3
set "spr0_height" to 3
set "spr0_cwidth" to 3
set "spr0_cheight" to 3
put c?? sprite p00 at 0 0
: "l"
if c?? Sprite_colliding p00 at 0 0 "collision"
wait for 1
goto "l"
Main points:
make sure you're setting the _cwidth and _cheight, and
make sure that you are using c?? for the Sprite_colliding checks if you are using relative coordinates. If you want to use absolute board coordinates, set the color to something other than c??.
Need a dispenser here.
Share this topic:
Page 1 of 1

Help






