Change Camera Target
In this tutorial you will learn how to change the camera target.
Summary
Download Example
Before you Start
You will need the following:
- Cursor Sprite with the origin set as the Center (Sprite Properties, click the Center button)
Note: If you already have a Display Object, skip to the next step.
In your game, it's always handy to have a Display Object. A Display Object is used to draw the interface of your game, this could be, the ammount of lives your character has left, how much health, number of coins ect.
- Create a New Object called o_display
- This object does not need a sprite since it is a display object.
- This object does not need a sprite since it is a display object.
- Add a Draw Event to the Display Object
Draw the Sprite at the current Mouse Position
To create the Custom Cursor, you basically have to repeatedly draw a sprite onto the screen at the position of the Mouse Cursor.
- Open the Draw Event on the Display Object
- Add the, Draw Sprite Action from the Drawing Tab
- Set the X value as, mouse_x
- Set the Y value as, mouse_y
- Set the Sprite as your Cursor Sprite
Putting mouse_x and mouse_y will draw the sprite at the co-ordinate of the
mouse creating a custom cursor.
Because the Draw Event happens on every step of your game (about 30 times a second)
the cursor sprite's position will constantly update.
The Sprite will ONLY follow your cursor around when it is in the Level. The best way to add this in is, on your character's Create Event, use the Create Instance action and create the o_display object, this will save you adding it to each level.