Namespace: CMPart

CMPart

Methods

addForce(direction, forceAmount)

Add a force to this part.
Parameters:
Name Type Description
direction number The direction to apply the force
forceAmount number The amount of force to apply

getPosX()

Returns the x position of the part

getPosY()

Returns the y position of the part

getRot()

Returns the rotation of the part in degrees

getType()

Returns the number representing the type for this part. See CM for a list of parts. Look for TT_STATE_

getVelX()

Returns the velocity of the part in the x axis

getVelY()

Returns the velocity of the part in the y axis

onCollision(otherPart)

Called when a collision occurs with the other part.
Parameters:
Name Type Description
otherPart CMPart The other part colliding with this part

setInteractive(value)

Sets the part to be user controlled
Parameters:
Name Type Description
value boolean whether part should be user controlled or not

setPosX(value)

Set the X position of this part.
Parameters:
Name Type Description
value number The x position of the part

setPosY(value)

Set the Y position of this part.
Parameters:
Name Type Description
value number The y position of the part

setRot(angle)

Sets the part rotation
Parameters:
Name Type Description
angle Number in degrees

setVelX(value)

Set the x velocity of this part.
Parameters:
Name Type Description
value number The x velocity of the part

setVelY(value)

Set the y velocity of this part.
Parameters:
Name Type Description
value number The y velocity of the part