Step 6: Nicer bat rotation

Let's make the bat rotate a little nicer. Go back to editing the script on the bat. We'll set the anchor point to the half-way down point.

Grab "When created" (from Events), and grab "Set anchor point x of myself" (from Transform). Drag them out above the other blocks.

Then grab "Actual width of myself" (from Transform), and "+" (from Operators). Change + to ÷ so that we set the anchor point to half the width of the bat. Arrange the blocks as shown.

Then duplicate the anchor point block, and in the copied block, change x to y and change width to height.

Lastly, we'll disable the physics on the bat (so it can't be pushed around by other objects). Grab "set physics enabled true" (from Physics) and drag that block to the bottom of the "When created" block. Change 'true' to 'false' to disable physics on the bat.

Now test the game again. The bat should now rotate around its halfway point.

In the next step we will turn our Makey Makey into a more immersive game controller.

results matching ""

    No results matching ""