# Animation extension with a function

**URL:** https://forum.makecode.com/t/animation-extension-with-a-function/16775
**Category:** AP CS Principles
**Tags:** extension
**Created:** [December 6, 2022, 11:15pm UTC](https://forum.makecode.com/t/animation-extension-with-a-function/16775 "2022-12-06T23:15:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ketheredge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ketheredge/32/4806_2.png) [@ketheredge](https://forum.makecode.com/u/ketheredge)
#### Post date: [December 6, 2022, 11:15pm UTC](https://forum.makecode.com/t/animation-extension-with-a-function/16775/1 "2022-12-06T23:15:45Z")

</div>

Hi I have a student who is creating a game where he is trying to use an animation extension with a function. He is getting an error that says “cannot an invoke an expression whose types lack a call signature. Type ‘animation’ has no compatible call signatures.” He said it was working with the function for a minute and then it stopped working. Can someone advise me if his walkingDown and walkingUp function is possible? [https://makecode.com/\_hb8YUwa4E6Yx](https://makecode.com/_hb8YUwa4E6Yx)

Thanks in advance!

---

<div class="post-metadata">

### Author: ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)
#### Post date: [December 8, 2022, 12:45am UTC](https://forum.makecode.com/t/animation-extension-with-a-function/16775/2 "2022-12-08T00:45:33Z")

</div>

Hi @ketheredge,

Some very quick 'n dirty suggestions for changes:

> **[Game Project](https://arcade.makecode.com/11740-97642-64441-34171)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

1. The main error you reported was due to the function `animations` calling the undefined/non-existing functions `walkingDown` and `walkingUp`, instead of the defined functions `walkingDown2` and walkinUp2`.
2. Then just streamlined and made consistent the name of the various animations in the `create animation of Idle/walkingUp/walkingDown with interval...`, `attach animation` and `activate animation` blocks.
3. Then moved around `attach animation`, `activate animation` and `stop all animations` blocks to coincide with the button presses and release of the up button.

Not very much thought through and probably with a lot of potential for improvement from my side, but, at least, it now kind of works ok…

---

<div class="post-metadata">

### Author: ![ketheredge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ketheredge/32/4806_2.png) [@ketheredge](https://forum.makecode.com/u/ketheredge)
#### Post date: [December 8, 2022, 5:54pm UTC](https://forum.makecode.com/t/animation-extension-with-a-function/16775/3 "2022-12-08T17:54:30Z")

</div>

Thanks so much @Vegz78!
