FANDOM


Your game's controls (axes and buttons) are defined in the project's administration tab.

CraftStudio.Input.GetAxisValueEdit

[number] CraftStudio.Input.GetAxisValue( [string] axis name )

Returns the specified axis' numerical value.

The value will be in the (-1, 1) range unless it's a mouse move value, in which case its the mouse's delta in pixels since the last frame.

CraftStudio.Input.IsButtonDownEdit

[boolean] CraftStudio.Input.IsButtonDown( [string] button name )

Returns true if the specified button is currently pressed, false otherwise.

CraftStudio.Input.WasButtonJustPressedEdit

[boolean] CraftStudio.Input.WasButtonJustPressed( [string] button name )


Returns true if the specified button was pressed during the last tick (1/60th of a second), false otherwise.

CraftStudio.Input.WasButtonJustReleasedEdit

[boolean] CraftStudio.Input.WasButtonJustReleased( [string] button name )

Returns true if the specified button was released during the last tick (1/60th of a second), false otherwise.

CraftStudio.Input.SetMouseVisibleEdit

CraftStudio.Input.SetMouseVisible( [boolean] visible )

Defines whether the mouse cursor should be visible or not while in the game's window. (This does not lock the mouse.)

Calls to this function while the mouse is locked will be ignored.

CraftStudio.Input.LockMouseEdit

CraftStudio.Input.LockMouse()

Hides the mouse cursor and locks it inside the game's window. Useful for games using the mouse to allow looking around.

CraftStudio.Input.UnlockMouseEdit

CraftStudio.Input.UnlockMouse()

Unlocks the mouse after it has been locked with CraftStudio.Input.LockMouse.

CraftStudio.Input.GetMousePositionEdit

​[table] CraftStudio.Input.GetMousePosition()

Returns a table with x and y containing the mouse position in pixels. x=0 is left, y=0 is top.

You probably don't want to call this function after the mouse has been locked with CraftStudio.Input.LockMouse as the hidden mouse will be kept in the center of the window.

CraftStudio.Input.GetMouseDeltaEdit

​[table] CraftStudio.Input.GetMouseDelta()

Returns a table with x and y containing the mouse delta since last frame in pixels. Positive x is right, positive y is bottom.

This function is particularly useful for mouse look after calling CraftStudio.Input.LockMouse.

Xbox 360 gamepad button mappingEdit

Button indices for the Xbox 360 gamepad:

  • DPadUp = 0
  • DPadDown = 1
  • DPadLeft = 2
  • DPadRight = 3
  • Start = 4
  • Back = 5
  • LeftStick = 6
  • RightStick = 7
  • LeftShoulder = 8
  • RightShoulder = 9
  • BigButton = 11
  • A = 12
  • B = 13
  • X = 14
  • Y = 15
  • LeftThumbstickLeft = 21
  • RightTrigger = 22
  • LeftTrigger = 23
  • RightThumbstickUp = 24
  • RightThumbstickDown = 25
  • RightThumbstickRight = 26
  • RightThumbstickLeft = 27
  • LeftThumbstickUp = 28
  • LeftThumbstickDown = 29
  • LeftThumbstickRight = 30

Axis indices:

  • 0 = Left stick, horizontal
  • 1 = Left stick, vertical
  • 2 = Right stick, horizontal
  • 3 = Right stick, vertical
  • 4 = Left trigger
  • 5 = Right trigger

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.