# Game Made in p5.js

**URL:** https://discourse.processing.org/t/game-made-in-p5-js/5133
**Category:** Gallery
**Created:** [November 2, 2018, 8:38pm UTC](https://discourse.processing.org/t/game-made-in-p5-js/5133 "2018-11-02T20:38:32Z")
**Posts on this page:** 6
**Page:** 2

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [November 5, 2018, 5:15pm UTC](https://discourse.processing.org/t/game-made-in-p5-js/5133/21 "2018-11-05T17:15:17Z")

</div>

The collision detection is definitely to be revised ^^

![SharkGame](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/ac5a4be8e68c478ff3640c559a30736b366a73f0.png)

---

<div class="post-metadata">

### Author: ![Quillbert1](https://avatars.discourse-cdn.com/v4/letter/q/f475e1/32.png) [@Quillbert1](https://discourse.processing.org/u/Quillbert1)
#### Post date: [November 5, 2018, 5:35pm UTC](https://discourse.processing.org/t/game-made-in-p5-js/5133/22 "2018-11-05T17:35:31Z")

</div>

@jb4x I’m glad you got it to work!

---

<div class="post-metadata">

### Author: ![Quillbert1](https://avatars.discourse-cdn.com/v4/letter/q/f475e1/32.png) [@Quillbert1](https://discourse.processing.org/u/Quillbert1)
#### Post date: [November 5, 2018, 5:35pm UTC](https://discourse.processing.org/t/game-made-in-p5-js/5133/23 "2018-11-05T17:35:59Z")

</div>

The collusion detection could be improved, i will admit. The bounding boxes are a bit off.

---

<div class="post-metadata">

### Author: ![Quillbert1](https://avatars.discourse-cdn.com/v4/letter/q/f475e1/32.png) [@Quillbert1](https://discourse.processing.org/u/Quillbert1)
#### Post date: [November 5, 2018, 5:42pm UTC](https://discourse.processing.org/t/game-made-in-p5-js/5133/24 "2018-11-05T17:42:23Z")

</div>

I have cut down the size of the hit boxes, hopefully it will be at least a little better now.

---

<div class="post-metadata">

### Author: ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)
#### Post date: [November 5, 2018, 6:01pm UTC](https://discourse.processing.org/t/game-made-in-p5-js/5133/25 "2018-11-05T18:01:56Z")

</div>

The collision detection could be improved further by using 2 boxes for the Penguin and another 2 boxes for the Shark.

It would mean 4 box intersection tests per collision (2x2) rather than the current one but with so few tests to make it won’t be noticeable.

![15](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b0d4e6ade4ea43c2e736673f3668f7baa6e2d9bf.png)

Still good fun!

---

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [November 5, 2018, 7:30pm UTC](https://discourse.processing.org/t/game-made-in-p5-js/5133/26 "2018-11-05T19:30:42Z")

</div>

To add to that, it could even be almost pixel perfect since the shapes are so simple. Ellipses and triangles basically (and maybe 2 squares and circles for the arm of the penguin).

The math for a ellipse/line intersection can easily be found online.

[Previous page](https://discourse.processing.org/t/game-made-in-p5-js/5133.md?page=1)
