Inputs
No support for joystick. because there is no joystick
Mouse
hidecursor()
showcursor()
disablemouse()
enablemouse()//turns on the mouse (comes on automatically)
console.log(getMouselocation())//{x: 147, y: 181, lastx: 394, lasty: 337}
//previous mouse position: layerx,layery,maybe you use this system in dragging
leftclicked = function(location,component){
if(component) console.log(component.name+": you are clicked me",location)
else console.log(location)//{x: 1026, y: 724}
}
rightclicked = function(location,component){
if(component) console.log(component.name+": you are right clicked me",location)
else console.log(location)//{x: 1026, y: 724}
}
mousemove = function(location,component){
if(component) console.log(component.name+": you are hover me",location)
else console.log(location)//{x: 1026, y: 724}
}
mouseup = function(location,component){
if(component) console.log(component.name+": you got your mouse up",location)
else console.log(location)//{x: 1026, y: 724}
}
mousedown = function(location,component){
if(component) console.log(component.name+": you got your mouse down",location)
else console.log(location)//{x: 1026, y: 724}
}
mousescroll = function(location,speed){
console.log(location,speed)//location could be: down,up
//down 100
//up -100
}
editcursor("pointer")//replaces the mouse
editcursor("url('test.gif'), auto")//you can change cursor to png
Edit cursors
Keyboard
disablekeyboard()//switches off the keyboard
enablekeyboard()//turns on the keyboard (comes on automatically)
keydown = function(key){
console.log(key)//ARROWDOWN
}
keyup = function(key){
console.log(key)//ENTER
}
keypress = function(key){
console.log(key)//W
}
Keys are always uppercase
Sometimes keypress may not understand or understand the key too much. To prevent this, you can change the forcepresstime in onload.js.
Touch screen
disabletouch()//touch closes
enabletouch()//turns on the touch (comes on automatically)
touchmove = function(fingers){
console.log(fingers)
/*
[
{finger: 1, x: 873, y: 459, component: false },
{finger: 2, x: 971, y: 423, component: {} },
]
*/
}
touchstart = function(fingers){
console.log(fingers)//[{finger: 1, x: 873, y: 459, component: false}]
if(component.name == "player1") console.log("You are clicked me")
}
touchend = function(fingers){
console.log(fingers)//[{finger: 1, x: 873, y: 459, component: false}]
}
Last updated