< Go Back

Moonlighter : Pong

About
It's a 2 player game, that both players are required to hit a ball to the other player's goal to score points. The art of the game is inspired by moonlighter.
Project Info
Role : Gameplay programmer
Time : 4 Weeks
Team Size : 1
Engine : Stencyl

Background

It’s a regular Pong game, as it was simple and easy to implement. However, I initially struggled with deciding on the art direction. In my mind, I kept thinking of the game Moonlighter, which features some of the best pixel art I’ve seen. Inspired by its style, I designed all the assets in my game, including the ball, paddles, and background, to reflect a similar aesthetic.

Collision Bug

Challenges

During the debugging stage, I noticed that even though the ball visually hit the paddle only once on screen, Stencyl detected multiple collisions. This might be an issue with how the Stencyl engine handles collision detection.

Solution

After the ball hit the paddle the first time, I repositioned the ball outside the paddle's collider to ensure it registered as a single collision.

Another mitigation solution I implemented was to move the paddles slightly backward after the initial collision to avoid overlapping.

Additionally, I deactivated the paddle's movement briefly when the ball hit the top or bottom of the paddle or the barrier, preventing further unintended collisions during that time.

Ball collide paddle script

To handle collisions with the paddle, I set the ball’s position based on whether it hit the front, bottom, or top of the paddle.

Additionally, I adjusted the ball's speed and trajectory accordingly.

This script also helps reposition the paddle backwards to prevent further unintended collisions.

Stuck prevention script

If the ball hits the  wall, then set the "Check Wall Collision" to true.

If the ball hits the top or bottom of the paddle then set the "Check Top Bottom Paddle Collision" to true

Paddle movement script

If both "Check Top Bottom Paddle Collision" and "Check Wall Collision" is true, prevent the player from moving the paddle to avoid further unintended collisions.

After 0.5 seconds, set one or both of these conditions to false.

What I Learned

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

What to improve

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

Results

Play The Game On Itch.io