Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Very similar concept to our game! But you definitely created the pinball feeling we were looking for.
May I ask how did you code the movements? Did you use the predefined physics object of Godot or did you code yourselves the behavior of the ball? We didn't quite get to create this quick bounces when the ball hits the bumpers.

Anyway, cool game, congrats to the team :D

Nice work on yours! I love how coherent the direction is.

I didn't code gameplay @Hawk777 was the magician there, however, I believe RigidBody2D.applyimpulse does most of the magic for the bounces.

Here is the line:

https://github.com/Zereijin/GMTK2023/blob/main/game_scene/bumper/bumper.gd#L34

The entire project is in the repo and we used Godot 4.1.0 (it came out just in time!). You can clone project there and poke around!

Thanks! The code is very helpful. For us it was our very first game, so it's very useful to see how other people do things.

Looking at yours, I can see that the real magic that we didn't get is actually in line 9, where I guess you create a vector with a direction that depends on the angle the ball hits the bumper. Good work there.

Here's ours, in case you are curious: https://github.com/juanfrcaliz/super_reversed_pinball

To expand on @teriyakisaurus’s answer, it’s actually a bit of a mix! The ball is the only `RigidBody2D` in the game. The two bumper types (circular pylon and flat bumper) are `StaticBody2D` objects and use `apply_impulse` to give an instant kick (they were @doublea999’s work). The flipper is an `AnimatableBody2D` and uses the normal Godot physics to hit the ball (it uses an `Area2D` to decide when to flip, but actually affecting the ball’s motion is done directly by Godot collision physics). Finally, the launch plunger is actually a mixture: initially (where the ball bounces and lands on top and then descends gradually as the plunger is pulled out) it’s an `AnimatableBody2D` with the ball sitting on top, but to actually fire, that worked too inconsistently, so I instead use `apply_impulse` and then move the `AnimatableBody2D` back to its original location a few seconds later.

Yeah, we also used a RigidBody2D for the ball and StaticBody2D for the bumpers. But the bounce effect was done in our case by changing a "bounce" value in the graphical interface on the bumpers objects.

The way you coded an impulse whose direction depends on the angle of the ball creates a much better effect!

I considered using the “bounce” property for some of the physics, but rejected it because, if I understand correctly, a bouncy object means the ball would bounce back harder the harder it hits, whereas pinball bumpers have their own power source, so they should really push the ball away with equal force no matter how fast or slowly it’s going when it arrives. Hence the idea of using impulse instead.

Yes I can clearly see what you're saying and from the gameplay of your game I can also see that it was the right call.