# CreateMouseJoint

## Description

Creates a mouse joint between a point and a sprite. This is typically used when dragging a shape with the mouse pointer, and attempts to move the sprite towards the given point using a force up to the maximum given. Specify an anchor point in world coordinates that will act as the initial hold point on the sprite. Any further change in the target position will attempt to move that point of the sprite to the new location. Use SetJointMouseTarget to change the location of the target position.

## Definition

CreateMouseJoint( iJointIndex, iSpriteIndex, x, y, maxForce )

void agk::CreateMouseJoint( UINT iJointIndex, UINT iSpriteIndex, float x, float y, float maxForce )

integer CreateMouseJoint( iSpriteIndex, x, y, maxForce )

UINT agk::CreateMouseJoint( UINT iSpriteIndex, float x, float y, float maxForce )

## Parameters

- iJointIndex - The ID to use for this joint.
- iSpriteIndex - The ID of the sprite to move.
- x - The x coordinate of the initial anchor point on the sprite.
- y - The y coordinate of the initial anchor point on the sprite.
- maxForce - The maximum force the joint can use to move the sprite.