TM.ScreenManager_Cursor

View source code: https://github.com/a-mean-blogger/text-game-maker-js/blob/master/src/managers/screen-manager/screen-manager_cursor.js

Type

Class (extends TM.IObject)

**This class is made to use as an sub property of TM.ScreenManager. so that's why the class name start with ScreenManager_

Purpose

A class that creates instances control the cursor. The cursor property of TM.ScreenManager's instance is the instance of this class.

Important Properties

  • isActive: It will be set true after calling init function, false after calling inactivate. The Object status(active/inactive) can be checked by this property.

Important Functions

  • init(): activates/initializes the instance. (It executes when the instance created)
  • inactivate(): inactivates the instance. the cursor will not show on Screen but move function is still valid.

Functions related to Cursor

  • move(x,y) : moves the cursor to x,y position
  • show() : shows the cursor.
  • hide() : hides the cursor.

**The cursor can not be outside of Screen

Code Example

**View example source code: screen-manager_cursor-tutorial.js

First, create an instance of TM.ScreenManager and assign to var TMS(Text Game Maker Screen). TM.ScreenManager_Cursor's instance is created and assigned to TMS.cursor

var TMS = new TM.ScreenManager();

Move cursor to (10,5)

TMS.cursor.move(10,5);

Run Example

Type these commands into the browser console on this page to test.

TMS.cursor.hide() //hide the cursor
TMS.cursor.show() //show the cursor
TMS.cursor.move(2,10) //move cursor to (2,10)

Comments

Add Comment

Login with SNS account to write comments. see details

UP