# My code doesn't work

**URL:** <https://discourse.processing.org/t/my-code-doesnt-work/10891>\
**Category:** Beginners\
**Tags:** homework\
**Created:** [May 3, 2019, 7:12pm UTC](https://discourse.processing.org/t/my-code-doesnt-work/10891 "2019-05-03T19:12:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![emilyabcde](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/emilyabcde/32/4987_2.png) [@emilyabcde](https://discourse.processing.org/u/emilyabcde)\
**Post date:** [May 3, 2019, 7:12pm UTC](https://discourse.processing.org/t/my-code-doesnt-work/10891/1 "2019-05-03T19:12:11Z")

</div>

Hello to anyone who is reading this…

I’m using p5js in my class and I’m having some trouble with a flappy bird game I’m trying to remix. Me and my teacher figured out that it was because the game was set to “rectMode(CENTER)” and I had replaced the obstacle with an image, and an image is NOT a rectangle so I don’t know if it can be centered like a regular rect. Any help?

Link to my code here: [https://editor.p5js.org/emilyabcde2ara/sketches/uVN9mhS7f](https://editor.p5js.org/emilyabcde2ara/sketches/uVN9mhS7f)

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 3, 2019, 7:44pm UTC](https://discourse.processing.org/t/my-code-doesnt-work/10891/2 "2019-05-03T19:44:22Z")

</div>

> [@emilyabcde](#):
>
> , and an image is NOT a rectangle so I don’t know if it can be centered like a regular rect.

> **[reference | p5.js](https://p5js.org/reference/#/p5/imageMode)**
>
> p5.js a JS client-side library for creating graphic and interactive experiences, based on the core principles of Processing.

---

<div class="post-metadata">

**Author:** ![outofambit](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/outofambit/32/24_2.png) [@outofambit](https://discourse.processing.org/u/outofambit)\
**Post date:** [May 3, 2019, 9:08pm UTC](https://discourse.processing.org/t/my-code-doesnt-work/10891/3 "2019-05-03T21:08:06Z")

</div>

yep! imageMode is the rectMode of images 🙂 anywhere you use rectMode should be replaced with imageMode. let us know if you have any questions and welcome to the forum! 💫

---

<div class="post-metadata">

**Author:** ![emilyabcde](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/emilyabcde/32/4987_2.png) [@emilyabcde](https://discourse.processing.org/u/emilyabcde)\
**Post date:** [May 8, 2019, 7:27pm UTC](https://discourse.processing.org/t/my-code-doesnt-work/10891/4 "2019-05-08T19:27:56Z")

</div>

Thank you so much! I appreciate it a lot. 🙂
