# Static and moving objects

**URL:** https://discourse.processing.org/t/static-and-moving-objects/11809
**Category:** Coding Questions
**Created:** [June 3, 2019, 7:50pm UTC](https://discourse.processing.org/t/static-and-moving-objects/11809 "2019-06-03T19:50:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![BallazX](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@BallazX](https://discourse.processing.org/u/BallazX)
#### Post date: [June 3, 2019, 7:50pm UTC](https://discourse.processing.org/t/static-and-moving-objects/11809/1 "2019-06-03T19:50:47Z")

</div>

Hello Guys,

I’m trying to do the following:

- I’m drawing some circle by clicking with the mouse
- I have a rect with a given coordinates
- I’d like to move the rect with the keyboard

Every time I’m moving the rect the old ones are still visible. If I put a background this solve the problem, but this way the circles are dissapearing.

How can I move the rect withouth deleting the circles?

Thanks for your answers!

---

<div class="post-metadata">

### Author: ![8BitRift](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/8bitrift/32/3495_2.png) [@8BitRift](https://discourse.processing.org/u/8BitRift)
#### Post date: [June 3, 2019, 11:31pm UTC](https://discourse.processing.org/t/static-and-moving-objects/11809/2 "2019-06-03T23:31:23Z")

</div>

Save the center and radius of the circles to a data structure, like an array-list, then every frame redraw the circles from the list.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [June 6, 2019, 2:28am UTC](https://discourse.processing.org/t/static-and-moving-objects/11809/3 "2019-06-06T02:28:12Z")

</div>

Another way to solve this problem is to draw the circles onto a PGraphics mycircles, and display that image every draw frame with image(mycircles, 0, 0) before drawing your rect.
