sprite collision

Page 1/5
| 2 | 3 | 4 | 5

By chaos

Paladin (809)

chaos's picture

14-10-2004, 01:13

In asm it's possible to get the coordinates of a sprite collision.
But how do I know which 2 sprites are colliding?

Should I compare the coordinates of every sprite with the collision, and return the two sprites with the shortest distance?

Checking every the distance of every sprite seems pretty cpu-time consuming.
So, are there better ways?

How do you think konami did it in e.g. space manbow, or Compile with aleste2

Login or register to post comments

By anonymous

incognito ergo sum (116)

anonymous's picture

14-10-2004, 01:20

since both games use collission with objects other than sprites, I think they just used a normal collission detection routine, not the V9938 one.

comparing boxes around sprites is indeed quite power consuming.. But there are many ways to optimize and other algorithms to try.

You could for instance keep a linked list of sprites (this is also handy if you want to do sprite cycling to avoid flickering), and keep it X and/or Y sorted.
That way you only have to check the nearest sprites..

By wolf_

Ambassador_ (9970)

wolf_'s picture

14-10-2004, 01:27

since both games use collission with objects other than sprites

o_O

In Space Manbow my ship is a sprite .. and flying enemy bullets are sprites as well.. collide = dead Smile

By chaos

Paladin (809)

chaos's picture

14-10-2004, 01:29

what if a bullet hits an enemy ship?

By flyguille

Prophet (3028)

flyguille's picture

14-10-2004, 01:37

after detecting some sprite colission you would to check which with which

By anonymous

incognito ergo sum (116)

anonymous's picture

14-10-2004, 02:51

o_O

In Space Manbow my ship is a sprite .. and flying enemy bullets are sprites as well.. collide = dead Smile
You are not thinking about your own bullets. They are characters, and so are most big enemies.

By BiFi

Enlighted (4348)

BiFi's picture

14-10-2004, 08:05

what if a bullet hits an enemy ship?Or two sprite bullets collide... Wink

By ro

Scribe (4707)

ro's picture

14-10-2004, 08:14

...or my fist colliding with your eye!

Anyway, Guyver is right with the "object" check rather than sprite checking. For animation, or whatever, you can have 1 object which can be (as set of) sprites or gfx/chars.

So keeping track of 1 object (for example using 3 sprites for one animation) can help decrease the total number of collision checks.

By viejo_archivero

Paragon (1395)

viejo_archivero's picture

14-10-2004, 10:30

So, chaos, you're making a shooter in asm?. Any shot or info about your project?. Or is at an early stage of development? Smile

By BiFi

Enlighted (4348)

BiFi's picture

14-10-2004, 10:36

Ro, please try to put your agression in a MRC Challenge entry next time. It benefits the whole MSX-community then.

By ro

Scribe (4707)

ro's picture

14-10-2004, 10:52

well, you know I'd just LOVE to punch your light out, now don't you. neh, I've got no BEEF with you. Hmm, a BEEF-It-UP challenge... hmmzz. Tongue

Page 1/5
| 2 | 3 | 4 | 5