playershots.bmx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. '===============================================================================
  2. ' Little Shooty Test Thing
  3. ' Code & Stuff by Richard Olpin ([email protected])
  4. '===============================================================================
  5. ' Player shots
  6. '===============================================================================
  7. Global bullets:TList=New TList
  8. Const WPN_NORMAL=0
  9. Const WPN_DEFLASER=1
  10. Type TBullet
  11. Global image
  12. Field link:TLink
  13. Field x#,y#,xs#,ys#
  14. Field rot#,alpha#,img
  15. Method Update()
  16. x:+xs
  17. alpha:+0.02
  18. If x>WIDTH
  19. ' remove
  20. Return
  21. EndIf
  22. For Local e:TEnemy =EachIn enemies
  23. If ( x>(e.x-16) And x<(e.x+16) And y>(e.y-16) And y<(e.y+16) ) Then
  24. e.hit()
  25. score:+100
  26. EndIf
  27. Next
  28. SetScale 1,1
  29. If player.primary_weapon = WPN_DEFLASER Then SetScale 1,0.5
  30. SetBlend ALPHABLEND
  31. DrawImage img,x,y
  32. End Method
  33. Function CreateBullet:TBullet( img, x#,y#, xs# )
  34. Local bullet:TBullet=New TBullet
  35. bullet.x=x
  36. bullet.y=y
  37. bullet.xs=xs
  38. bullet.alpha=0.1
  39. bullet.img=image
  40. bullets.AddLast bullet
  41. End Function
  42. End Type
  43. '===============================================================================
  44. '
  45. '===============================================================================