# Interactive Animations Game

**URL:** https://forum.code.org/t/interactive-animations-game/40557
**Category:** Coding and Debugging Help
**Tags:** csd-unit-3
**Created:** [March 17, 2025, 2:35pm UTC](https://forum.code.org/t/interactive-animations-game/40557 "2025-03-17T14:35:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rbowens2](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rbowens2](https://forum.code.org/u/rbowens2)
#### Post date: [March 17, 2025, 2:35pm UTC](https://forum.code.org/t/interactive-animations-game/40557/1 "2025-03-17T14:35:06Z")

</div>

Student want’s chip bag and banana peel sprites to respawn at the top of the screen when they touch “Critter”. He also wants to use a score variable and have score go up by one each time critter touces one of the objects. Any advice?

> **[Check out what I made](https://studio.code.org/projects/gamelab/KKM56BqWt97RvqIBVwL0lsYrFWRslz45-Ms3F0rFOhE)**
>
> I wrote the code myself with Code.org

---

<div class="post-metadata">

### Author: ![varrience](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/varrience/32/8042_2.png) [@varrience](https://forum.code.org/u/varrience)
#### Post date: [March 17, 2025, 7:04pm UTC](https://forum.code.org/t/interactive-animations-game/40557/2 "2025-03-17T19:04:20Z")

</div>

don’t use `sprite`

- you don’t have it declared
- it won’t change the property you want
- it will error out since it doesn’t exist
- be explicit in what you wish to change in the sprite object variable it is assigned to

```auto
if (critter.isTouching(chipBag)) {
  score = score + 10;
  chipBag.x = randomNumber(1, 390);
  chipBag.y = 0;
}
if (critter.isTouching(ChipBag2)) {
  score = score + 10;
  ChipBag2.x = randomNumber(1, 390);
  ChipBag2.y = 0;
}
if (critter.isTouching(BananaPeel2)) {
  score = score + 10;
  BananaPeel2.x = randomNumber(1, 390);
  BananaPeel2.y = 0;
}
if (critter.isTouching(BananaPeel)) {
  score = score + 10;
  BananaPeel.x = randomNumber(1, 390);
  BananaPeel.y = 0;
}

```

# Varrience
