jQuery spawning div and collision detection

前端 未结 2 1164
攒了一身酷
攒了一身酷 2021-01-29 10:03

So im almost at the end of my school homework project im just missing two major things i can\'t seem to figure out:

1.How to spawn the pipe obstacles with a random posit

2条回答
  •  清歌不尽
    2021-01-29 10:16

    How to spawn the pipe obstacles

    The pipes happen at a regular interval or distance. You can either check the time elapsed or you can check the distance traveled by existing pipes.

    Second i need a help with the collision detection

    Pipes have width and height, as well as position. Essentially, your pipes are boxes. This also means the same for the bird. I believe it's called a "bounding box". You can check if any of the edges of the bird if it intersects with the edges of the box.

提交回复
热议问题