Enemy Scaling

Scaling physics driven entities is a bit tricky. All our little guys have a collider on them since we want them to be able to interact with the world around them and bash into enemies.
You shouldn't scale these colliders as it could result in physics issues.
Normally, the way you make the collision shape match your sprite is to resize the actual shape itself. But no one wants to do that manually. We want dynamically scaled spaceships!
So we have to do this with code. Our sprites are setup in scene with their scale at 1.0 x 1.0. This means we can simply multiply the new scale value by the collision shape's values. In our case, we have a capsule shape, so we'll be dealing with radius and height.
A quick caveat is that if your collider isn't centered at (0,0), you'll want to apply that scale to its position, too.
Here's a code snippet of this concept:

Note that we had to duplicate and swap out the collision shape to make it unique, otherwise as each ship spawned in they would update the colliders for all of the other ships!
For our purposes, you can see in the snippet that we had to scale the particles too. If we didn't, we'd have tiny spaceships with giant flame trails, which isn't ideal.
--
Play the Game
- On Wandering Door Games
- On itch.io
As always, the game is open source!
You can find it on our Codeberg.
💜 Love open source projects?
Here are ways you can support us making them!
Get Satellite Bash
Satellite Bash
Defend your tiny planet against various space hazards
| Status | Released |
| Author | Wandering Door Games |
| Tags | Arcade, foss, Godot, Mouse only, Open Source, Singleplayer, Space |
| Languages | English |
| Accessibility | Configurable controls, Interactive tutorial |
More posts
- Star Generation RevisitedAug 16, 2025
- Spawn Exclusion ZonesAug 09, 2025
- Satellite OrbitsAug 02, 2025
- Score FeedbackJul 25, 2025
- Star GenerationJul 11, 2025
- Satellite Bash - Out Now!Jul 08, 2025
- Planet GenerationJul 08, 2025
Leave a comment
Log in with itch.io to leave a comment.