# Gradually change the sprite of an object

**URL:** https://discourse.processing.org/t/gradually-change-the-sprite-of-an-object/38851
**Category:** Coding Questions
**Tags:** homework
**Created:** [September 19, 2022, 3:30am UTC](https://discourse.processing.org/t/gradually-change-the-sprite-of-an-object/38851 "2022-09-19T03:30:32Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [September 23, 2022, 10:13am UTC](https://discourse.processing.org/t/gradually-change-the-sprite-of-an-object/38851/2 "2022-09-23T10:13:57Z")

</div>

Hi @dmlong,

First thing I noticed is that you declare your classes with a lower case name which might be confusing with other variable names. Instead use the PascalCase convention like `Wall` and `BrickWall`.

> [@dmlong](#):
>
> But now I want to change the sprite of the wall when it is shot, so that it gradually transform from a normal wall to a broken wall, to dust, and then to nothing.

For that you need some kind of timer. When the wall is touched by a projectile, you trigger a variable to `true` and start counting time. Then each time you draw the wall, you display a different sprite depending on how close to the “end of life” limit a wall have.

See this for implementing a timer: [Brick Game Timer Question - #2 by josephh](https://discourse.processing.org/t/brick-game-timer-question/38605/2)

---

_[View the full topic](https://discourse.processing.org/t/gradually-change-the-sprite-of-an-object/38851)._
