Comparing 2 types

Blitz3D Forums/Blitz3D Beginners Area/Comparing 2 types

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.


Yes 'handle' is a pointer to itself and collision is the pointer to the entity that it collided with.



so red\handle = itself?

If so then why loop through all the reds if the blue\collision = the exact red that collided with it?

so this:
for blue.blue_s=each blue_s
for red.red_s=each red_s

if blue\collision = red\handle
blue\collisions=blue\collisions+1
endif
next
next


could be this:
for blue.blue_s=each blue_s

if blue\collision <> NULL
 blue\collisions=blue\collisions+1
endif

next


Even then I'm not sure I understand why you have a collisions counter, unless you intend to keep track of how many times the blue instance got hit...afterall the way you have this set up, blue can only collide with one red per game update.


The reason why I used types:
1.
I need to know which ship fired the bullet so I can tell which type of bullet was used
2.
I need to give the ship that got hit a direction to go.The opposite direction to the other ship.

Is there a better way?



Give the bullet a flag to tell it what type of bullit it is, along with variables to describe it's direction...else you can end up with some funky problems if the fireing ship is freed (destroyed) before the bullet hits anything, or if the fireing ship changes direction before the bullet hits something.