dMZX Forums: Sprite Collision - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Sprite Collision

#1 User is offline   cwags55 

  • Member
  • PipPip
  • Group: Members
  • Posts: 56
  • Joined: 14-October 00

Posted 06 February 2007 - 04:04 PM

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?
cwags55
Uniquesoft
0

#2 User is offline   CJA 

  • «≡larch bucket≡»
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,262
  • Joined: 23-June 05
  • Gender:Male
  • Location:......@.c....

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"



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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users