METS BLOG

METS BLOG

Libgdx tutorial beginner Part 6 – Hazards

Here we will see three types of hazards. If bob collides with them he will die and respawn on the last dispenser/checkpoint.

  • Laser might look like it has some crazy code in it and it has 🙂 Here is how it works
  • It takes a position as a parameter, this is the place we want to put our laser
  • Then it checks which side of the given position is a wall tile
  • After that is decided it will look for another wall tile in the opposite direction, when it finds it that will be the endpoint for the laser beam
  • In the update method collision with bob and cube are checked, collision with cube will update the endpoint
  • Other hazards are similar and simple but if you have questions just ask


Leave a Reply

Your email address will not be published. Required fields are marked *