Discord
Login
Community
DARK THEME

Custom mousepointer

in some videogames you dont have the normal mousepointer. but how i can build a custom mouse pointer in my game

init = function()

aimx = 0

aimy = 0

screen.setCursorVisible(false)

end

update = function()

aimx= mouse.x

aimy= mouse.y

end

draw = function()

screen.clear()

screen.drawSprite("aim",aimx,aimy,50,50)

sprites["aim"].setFrame(1)

end

I have this in one of my games. I used the code:

update = function() screen.setCursorVisible( Invisible ) end

and then

draw = function() screen.drawSprite(mouse.x, mouse.y, 32, 32) end

For this to work you have to make the mouse sprite top left corner in the middle of the sprite page.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community