Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2d collision

Author
Message
Chilled Programmer 420
20
Years of Service
User Offline
Joined: 24th Nov 2005
Location: NOT SAYING!, i dont wanna get kidnapped!
Posted: 1st Dec 2005 22:06
im makin a program where i repetidly need to check to see if a lot off bullet sprites have hit chareter sprites, i havent evan got that many enemys yet and its already lagging, is there a more efficiant way to check every sprite against every other enemy?

example incase u dont understant coz that sounds a bit dodgy:

there could be up to:
1 player
30 his shots
i special attack

10 enemys
15 enemy shots


every player bullet needs to be checked on every enemy
every enemy bullet needs to be checked on player
player needs to be checked on enemy
if possible, bullets against bullets to

cheers

LIVE LIFE LOUD LOVE MUSIC
rock, metal, punk, emo, ska, reggae, indie, goth, 70's rock, 80's rock, death metal, poppunk, grunge
***caffine, weed, programming and rock addict***
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 2nd Dec 2005 00:55
Show some code, and we may work it out...
Chilled Programmer 420
20
Years of Service
User Offline
Joined: 24th Nov 2005
Location: NOT SAYING!, i dont wanna get kidnapped!
Posted: 2nd Dec 2005 11:01
its ight i found it out:

insted of saying:

for bullet = 1 to num of shots
for c = 1 to numofaliens
if sprite collision(bullet, c)
``do stuff
endif
next c
next bullet

i use the very simple code
if sprite collision(bullet, 0)
in the move bullet command

LIVE LIFE LOUD LOVE MUSIC
rock, metal, punk, emo, ska, reggae, indie, goth, 70's rock, 80's rock, death metal, poppunk, grunge
***caffine, weed, programming and rock addict***

Login to post a reply

Server time is: 2026-07-07 02:19:25
Your offset time is: 2026-07-07 02:19:25