Almost There...


Ok so for today's update I focussed on implementing various features to the game including:

Working AI 

I managed to get the AI to work in both a single player vs AI mode and an AI vs AI demo mode. It ended up being a fairly simple AI that worked by comparing the relative positions of the Paddles and the ball then implemented a movement function to move the paddle up if the ball was higher and vice versa. With limitations on the speed of the paddle once the ball starts getting faster it becomes pretty easy to get past. The AI will also only move the pattle if the ball enters its respective side of the court and will stop once the ball impacts the paddle until it comes back across the centre line.

Ball Reset

For the ball reset I initially tried to work out a way to re instantiate the ball object after destroying the original ball on entering the goal. However this proved to be more difficult than expected and i resorted to jsut moving the ball back to the original position, setting it's Vector3 velocity back to zero and calling the initial movement code again.

Sounds 

I grabbed a free 8 bit sound pack from the unity assets store and applied them for ball impacts, goals scored and the endgame celebration screen. 

Link to the Asset pack used: https://assetstore.unity.com/packages/audio/sound-fx/8-bits-elements-16848

Fixes:

Fixed the ball leaving the play area when it gets too fast forthe triggers by implementing a trigger that resets the ball to the centre of the screen like with the goal scored reset but doesnt increment the score of either player.

Files

KIT109 PONG v3.zip 6.8 MB
Jul 30, 2023

Get KIT 109 PONG

Leave a comment

Log in with itch.io to leave a comment.