Skip to main content
โ€น Back to Tutorials
Intermediate Unity

Making a Mobile Bounce Game with Unity 3D and Playmaker - Move the Paddle & Set Up Ball Trail

Dec 20, 2020
About this tutorial

Beginner Game Design tutorial series creating a simple Bounce type game using Playmaker within Unity 3D. In this video, we will set up the paddle to follow the mouse movement and also create a trail for the ball. Absolutely NOCODE. Also make a skateboard game playlist: https://bit.ly/34m4SHT ๐Ÿ‘‰๐Ÿผ

Written Guide

Part three of the bounce game series makes the game playable: the paddle follows the mouse left and right, and the ball gets a tapered, glowing trail so the screen has some life to it. Both are quick wins โ€” one small FSM and one built-in component, each with a handful of settings that matter.

Read the mouse position

Mouse control is the choice here, though keyboard input or mouse drag would work the same way. Select the controller (paddle), add an FSM, and name both the object's FSM and the FSM itself move controller โ€” naming both is a good habit once projects grow. Add a Get Mouse X action and store the result in a variable called mousex. Turn on the debug toggle at the bottom of the Playmaker window and press play: you can watch the number change as the cursor sweeps across the screen, which confirms exactly what data you're capturing before you use it.

Drive the paddle position

Add a Rect Transform Set Local Position action; Playmaker warns the object needs a RectTransform component and adds it when you click OK. The FSM lives on the controller, so the owner is the object to move. Point the X position at the mousex variable and check every frame โ€” get the information, then use it, every single frame. Press play and the paddle glides with the mouse. That's the entire control scheme.

Add a trail to the ball

Select the ball and add a Trail effect (Effects > Trail). The width graph at the top defaults to 1 unit โ€” wider than the half-unit ball, which looks wrong immediately. Drag the width down slightly under the ball's size, then double-click the graph line to add a handle, pull the far end to zero, and smooth the curve so the trail tapers away gracefully over its lifetime.

Polish the trail settings

Color the gradient something warm โ€” a pink works โ€” starting partially transparent and ending fully transparent. Bump up the end cap vertices so the trail's ends are rounded instead of squared off. Under lighting, turn off both cast shadows and receive shadows; a trail has no business doing either. Finally, the time setting controls how long each section of trail persists โ€” the default 5 seconds leaves a huge streamer, so drop it to 1 second for a tight comet tail. Tune longer or shorter to taste for your game. Next up in the series: scoring, with a UI counter that ticks up every time the ball hits the paddle.

Unity tools by Bliz Studio
Built for our own games — now on the Asset Store

Multi Tag — unlimited hierarchical tags for any GameObject. Hierarchy Pro — style your whole hierarchy with rules. Made by a Unity dev, for Unity devs.

Explore our Unity assets →