Gamecodeur

Untitled

Jan 6th, 2022
1,319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. lstBullets = {}
  2.  
  3. function AddBullet(ptype,px,py)
  4.     table.insert(lstBullets, {type=ptype,x=px,y=py})
  5. end
  6.  
  7. AddBullet("player",10,10)
  8. AddBullet("ennemy",10,10)
  9.  
  10. for b1=#lstBullets,1,-1 do
  11.     local bullet1 = lstBullet[b1]
  12.     if bullet1.type == "player" then
  13.         for b2=#lstBullets,1,-1 do
  14.             local bullet2 = lstBullet[b2]
  15.             if bullet2.type == "ennemy" then
  16.                 if bullet1 ~= bullet2 and Collide() == true then
  17.                     if bullet1.type ~= bullet2.type then
  18.                         -- Collision entre 2 types diffΓ©rents
  19.                     end
  20.                 end
  21.             end
  22.         end
  23.     end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment