Changing the Gallery

Because we have our collisions set up, we can now control how different objects in our game interact with one another. To add an additional element of difficulty to our game, we’ll have the gallery items change their location whenever they hit the ground. We’ll use a For . . . Next statement that will check every gallery item to see if it has collided with the ground. If a collision has occurred, we’ll reposition the item that has collided with the ground to a random location on the playing field. If you are unclear on the code used here, review Chapter 11, “Collisions.” Enter the following code in bold:

MoveEntity dolphin(a), 0,-0.2,-0.3
      Next
;Changing the position of gallery items
      For q = 0 To maxbull
      If CountCollisions (terrain)
         smash=CollisionEntity (terrain,1)
         PositionEntity smash, 0,Rand(10,100),Rand
           (-100,100)
      EndIf
      Next

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.46.78