November 28, 2020, 02:01:42 PM

Author Topic: [bb] Easy Collisions Example by Captain Wicker (crazy hillbilly) [ 1+ years ago ]  (Read 592 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Easy Collisions Example
Author : Captain Wicker (crazy hillbilly)
Posted : 1+ years ago

Description : An easy example of collision detection by me

Code :
Code: BlitzBasic
  1. AppTitle("Collisions Example")
  2. Graphics3D 800,600,32,2
  3. SetBuffer BackBuffer()
  5. camera=CreateCamera()
  6. light=CreateLight()
  8. Const entity_sphere=1
  9. Const entity_sphere2=2
  11. sphere=CreateSphere(32)
  12. PositionEntity sphere,-.85,0,5
  14. sphere2=CreateSphere(32)
  15. PositionEntity sphere2,.85,0,5
  17. EntityType sphere,entity_sphere
  18. EntityType sphere2,entity_sphere2
  20. While Not KeyDown(1)
  23. EntityColor sphere,Rnd(255),Rnd(255),Rnd(255)
  24. MoveEntity sphere,0,.1,0
  25. TurnEntity sphere,1,0,1
  27. EntityColor sphere2,Rnd(255),Rnd(255),Rnd(255)
  28. MoveEntity sphere2,0,.1,0
  29. TurnEntity sphere2,1,0,-1
  31. Collisions entity_sphere,entity_sphere2,1,2
  32. Collisions entity_sphere2,entity_sphere,1,2
  34. If EntityCollided(sphere,entity_sphere2) Then RuntimeError("Collisions Detected!!!")
  36. If EntityCollided(sphere2,entity_sphere) Then RuntimeError("Collisions Detected!!!")
  38. UpdateWorld
  39. RenderWorld
  40. Flip
  41. Wend

Comments :

Captain Wicker (crazy hillbilly)(Posted 1+ years ago)

 Very Nicely Done if I do say so myself. ;)

big10p(Posted 1+ years ago)

 Why do you insist on spamming the code archives with pointless code?

Captain Wicker (crazy hillbilly)(Posted 1+ years ago)

 It isn't pointless, It shows how simple it is to detect collisions. :PWhat's so wrong about a fellow doing some good for people struggling with collisions eh? :D

Rob the Great(Posted 1+ years ago)

 <div class="quote"> What's so wrong about a fellow doing some good for people struggling with collisions eh? </div>Nothing's wrong with it, but this belongs in tutorials, not in the archives. The archives should be reserved for advanced or complicated processes that simplify a technique, usually in 1 to 2 line functions."Collisions" is a Blitz native command, and while you demonstrate its use effectively, it was not designed by you, and so this really doesn't belong in the archives.Instead, this should go in tutorials because you are showing how the Blitz system works.However, if you made your own custom Collisions system that is better or easier to use than Blitz's, the archives would be the perfect place to submit this.

Captain Wicker (crazy hillbilly)(Posted 1+ years ago)

 Oops! I suppose so then ^^;


SimplePortal 2.3.6 © 2008-2014, SimplePortal