# Using functions in different scenes

**URL:** <https://phaser.discourse.group/t/using-functions-in-different-scenes/15642>\
**Category:** Phaser 3\
**Created:** [July 28, 2026, 11:18pm UTC](https://phaser.discourse.group/t/using-functions-in-different-scenes/15642 "2026-07-28T23:18:16Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![johnSSG](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/johnssg/32/8138_2.png) [@johnSSG](https://phaser.discourse.group/u/johnSSG)\
**Post date:** [July 29, 2026, 2:15am UTC](https://phaser.discourse.group/t/using-functions-in-different-scenes/15642/10 "2026-07-29T02:15:57Z")

</div>

In my example, I have added static data to my class (also called properties), so I have a property called species, which is an array and not a function. This represents static data included in the class. So it’s not the static keyword that makes something a function. If you want a static method (aka function), you would put static functionName, like where I have:

`static spawnResidentPets(scene) {}`

That defines a static method (function) within my Animal class. This is a class I can use without instantiating the class. Like I don’t have to do this:

`let a = new Animal(); a.spawnResidentPets(scene);`  
This isn’t really Phaser stuff, this just has to do with how Object-Oriented Programming works.

Don’t call your class staticFunctions. Think of your program in terms of objects and their methods (functions) and data (properties). I don’t know how things are labeled in your app, but maybe the shieldEffect() is on a Player class, for example.

The static functions in the class can interact with whatever data you pass them, so if you pass the scene, it will have access to all the scene data and it’s scene agnostic in that way, so you can pass it different scenes and it will act on that scene. If there is data outside the scene, you’ll have to pass that as well and yeah I would include these prior to the scenes so they’re available when the scene starts up.

I hope this answers your question. You might want to study a little more about how to use classes and stuff. It’s an involved topic and it’s good to fully grasp it.

---

_[View the full topic](https://phaser.discourse.group/t/using-functions-in-different-scenes/15642)._
