# Guide: Spinning

There are several ways you can make something spin. The correct to do it depends on exactly what you want it to do.

### If you just want a spinning background/foreground image

Use this method if you want a spinning image that looks pretty but doesn't affect the Goo Balls, like the small windmills in Blustery Day, or the black cogs in Upper Shaft.

Add a SceneLayer item, apply the image then set:

• anim = rot_1rps
• animspeed = 0.1 for example

In the above example, the image will rotate at 0.1 rotations per second, and thus complete its rotation once every ten seconds.

### If you want a spinning cog or gear

If you want something to spin and also kill balls or pop a Beauty ball, like the main windmill in Blustery Day or the "buster" cogs, you are best doing it with two items:

• Add a SceneLayer exactly the same as the above. (this gives you the spinning image)
• Add a circle that's a similar size as the image and move it to the same place and set:
• static = true
• tag = {whatever} deadly or ballbuster - see tag attribute

### If you want something that balls can grab hold of, or get hit by

Something that interacts with the balls and has physics effects, like the wobbly head in Chain or the wheels in Third Wheel, is achieved as follows:

• Add a Geometry object (Rectangle, Circle or Composite).
• Move it into place, set its image property and position the image.
• Set the object to be static=false and give it some mass - More information on Dynamic Geometry.
• Add a hinge and set body1={id of geometry object}.
• Move the hinge the centre of the object (or the point you want to it to spin around).

If you're happy with something that is moveable but doesn't rotate on its own, like the wobbly head in Chain, then you're done.

If you want it to spin on its own or lift balls, then on the geometry object set
rotspeed = 0.1.

#### Note about the mass of the object

In this last case, the mass you give to the object affects the power of the motor spinning it. If you set the hinge dead centre in the object it will spin fine regardless of its mass. But if you put the hinge off center, you will find that the motor may struggle to lift the object up one side, but it will drop down quickly on the other.

Also, if you have a "low" mass (like 10), as soon as a ball attaches, the motor will struggle to lift it. If you have a "high" mass (like 10,000), the wheel will grind on regardless and will lift many balls without slowing down at all.

### If I can make it spin by just setting the rotspeed, what are motors for?

Well it's a good question. In fact there is only one proper motor object in the whole of the original game - on the robot's head in You Have to Explode The Head.

It seems that even 2D Boy found motors problematic / annoying / mostly pointless, and that using rotspeed and automatically setting the motor's power based on the mass of the object (discussed above) was far easier in most cases, than actually using a separate motor item.

The only time you really need a motor is if you want something that spins weakly but is also heavy, like the Robot's head.

You can't use rotspeed because that would automatically use a strong motor for a heavy object, so this is the only time you really need to use them.

Note: Since motors don't have a size or a position or anything else we could meaningfully draw, they don't show up in the Level View, so you must add and select them in the scene tab.