Messing with the mouse
Moderators: Bob the Hamster, marionline, SDHawk
- Master K
- King Slime
- Posts: 1899
- Joined: Sat Jun 11, 2011 9:40 pm
- Location: A windswept rock in the Atlantic Ocean
Messing with the mouse
So, I have been working on a little game that is testing out the mouse. I was wondering if you could script it so that when you click on an NPC, something would happen, like you could show a text box, move them with the mouse as long as the left button is held down, or when they get clicked on, they move to a new tile. Is any of this possible?
- Spoonweaver
- Liquid Metal King Slime
- Posts: 6247
- Joined: Mon Dec 08, 2008 7:07 am
- Location: Home
- Contact:
Use the "NPC at pixel" command. If your mouse cursor is a slice rather than an NPC, it's even easier, because it won't return the cursor NPC. For example.
Code: Select all
if (mouse click (left button)) then (
variable (npc ref)
npc ref := npc at pixel(mouse pixel x, mouse pixel y)
if (npc ref) then (
# something!
)
)