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.

DarkBASIC Discussion / a question of collision

Author
Message
the spratster
20
Years of Service
User Offline
Joined: 19th Apr 2005
Location:
Posted: 19th Apr 2005 13:56
i ve made a gun fire bullets, and i want to know how to shoot somthing so that it gets deleted if there is a collision between them. but something more efficent than writing:
if 1=object collision(2,veriable#) then delete object veriable#
over and over.

any help will be happily accepted.
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 19th Apr 2005 22:55
i would do some thing like this:
dim object_type$( nrOfTotalObjects )

make bullets and then:
object_type$( bulletid ) = "bullet"

make enemies and then:
object_type$( enemyid ) = "enemy"

now for collision:
for x = 1 to nrOfTotalBullets
object_collision = object collision( x, 0 )
if object_collision > 0
if object_type$( object_collision ) = "enemy"
delete object object_collision
endif
endif
next x

you get the point

the spratster
20
Years of Service
User Offline
Joined: 19th Apr 2005
Location:
Posted: 23rd Apr 2005 02:36
clever stuff, thank you but i dont get it.

Login to post a reply

Server time is: 2025-06-01 02:11:15
Your offset time is: 2025-06-01 02:11:15