Finalised Concept
For my final project, I will design and build an interactive penalty-kick football game that combines p5.js, Arduino, and a custom physical controller. My goal is to create a fun, responsive experience where players physically control the shooter’s movement and the direction of their kick using a real-world device. At the same time, the screen will display a dynamic game environment – complete with a goalkeeper, goalpost, and shooting animations.
This project will allow me to explore hardware-software integration, serial communication, real-time input handling, and user-centered interface design.
Gameplay
Player one will use a custom-built controller, which I will design using laser-cut casing and embed an Arduino joystick. The joystick will allow the player to select the ball’s direction – left, center, or right. Player one will also have a push button to initiate the kick toward the selected direction. The player sprite will move toward the ball when the button is pressed, and then the ball will move toward the chosen direction while the shooter remains in position.
Player two will control the goalkeeper using hand movements detected via ML5.js. By moving their hands left, right, or center in front of a camera, the player will slide the goalkeeper sprite across the goal to attempt a save. The game will simulate a real penalty shootout in a simplified and engaging way.
Arduino to p5
-
The joystick and push button inputs from the custom controller will be read by Arduino and sent to p5.js via serial.
-
These inputs will determine the direction of the ball and when the kick is initiated.
p5 to Arduino
-
After the ball reaches the goal or the goalkeeper makes a save, p5.js will send feedback to Arduino.
-
If a goal is scored, a green LED connected to the Arduino will turn on.
-
If the goalkeeper saves the ball, a red LED will turn on.
-
This provides tactile and visual feedback, creating a more immersive experience for the players.
Progress So Far
So far, I have focused on setting up the digital environment and assets for the game. I have:
-
Prepared the visual assets
-
Loaded images for the football pitch, shooter, goalkeeper, ball, and goalpost into p5.js.
-
Scaled the images dynamically based on the window size to ensure the game will be responsive in full-screen mode.
-
Adjusted the positions of the shooter, ball, goalkeeper, and goalpost so that the gameplay layout is accurate and visually balanced.
-
-
Implemented basic classes in p5.js
-
Created classes for the pitch, shooter, ball, goalkeeper, and goalpost.
-
Ensured each class has a display() method to render its sprite correctly on the canvas.
-
Tested the scaling logic and made the goalpost larger for a better gameplay area.
-
-
Set up fullscreen functionality
-
Pressing the F key now toggles full-screen mode.
-
All sprites and background images adjust automatically to fit the screen size.
-
-
Planned the shooting logic
-
Decided that the shooter will move toward the ball when the push button is pressed.
-
Once the shooter reaches the ball, the ball will move toward the selected direction (left, center, or right).
-
The shooter itself will remain in position while the ball moves.
-
-
Laid groundwork for Arduino communication
-
Decided on bidirectional communication: joystick and push button inputs from Arduino will control the ball direction, and LEDs will provide visual feedback for goals and saves.
-
Begun planning the serial communication structure between Arduino and p5.js.
-
Next steps:
-
Build and test the custom controller once I receive the Arduino joystick.
-
Implement keyboard-controlled ball movement to simulate the shooter action before integrating the controller.
-
Add hand-detection logic with ml5.js to control the goalkeeper.
-
Integrate LED feedback for scoring and saves.

