If collision
Blitz3D Forums/Blitz3D Beginners Area/If collision| 
 | ||
| I feel kind of like a newb asking this, but i have this collision problem. I've been away from 3d a few months, doing 2d projects, and am a bit rusty. I was wondering, how do you make a certain thing happen when two objects collide, asside from the options it gives you. Such as, if i were to make a bullet hit someone, how would i make it hurt them, and disapear? I was thinking something like this:  If collisions Type_Player, Type_bullet,2,2 then
                       hideentity bullet
                       player\health = player\health - 1
          endif But when i do something along the lines of this, i get an Expecting End Of Line error. How would i do something like this? An if statement with the condition being a collision. Thanks alot everyone! -Kevin | 
| 
 | ||
| Wouldn't it be... If EntityCollided(Type_Player,type_bullet)=1
          blah blah...
Endif  | 
| 
 | ||
| 
For p.Player = Each Player
    For b.Bullet = Each Bullet	
        If EntityCollided( b\bullet, Player_Collision_Type ) = p\bullet
            FreeEntity b\bullet
            Delete(b)
			
            p\health=p\health-1
        EndIf	
    Next
Next
 | 
| 
 | ||
| Wouldn't it be... If EntityCollided(Type_Player,type_bullet)=1 blah blah... Endif Nope. If you've got more than one player .... store the players type handle in the name for quick access ... p.player = new player p\health = 100 p\mesh = createsphere() entitytype p\mesh, type_player nameentity p\mesh , handle( p ) To check which player is hit etc... 
for b.type_bullet = each type_bullet
  Entity = entitycollided( b\Mesh ,  type_player )
  if Entity > 0
    p.type_player = Object.type_player( EntityName( entity ) )
    p\health = p\health - 1
    freeentity b\Mesh
    delete b
  endif
next
Stevie | 
| 
 | ||
| Yeah you are right Stevie G.. | 
| 
 | ||
| Thanks alot everyone, ill try that out! :) -Kevin | 
| 
 | ||
| Mine is working too! :D |