Post new topic    
King Slime
Send private message
Messing with the mouse 
 PostSun Aug 28, 2011 6:37 pm
Send private message Reply with quote
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?
Liquid Metal King Slime
Send private message
 
 PostSun Aug 28, 2011 6:59 pm
Send private message Reply with quote
Yes, all of that is possible.
Have you seen my game Slimes!? It has a lot of mouse control in it. It might be good to give it a go just to get an understanding of what is possible with the mouse on the ohr.
King Slime
Send private message
 
 PostSun Aug 28, 2011 7:03 pm
Send private message Reply with quote
I already played Slimes, spoon. Thanks for reminding me though, because now I know it is possible. But, how can the things I said above be scripted?
Metal King Slime
Send private message
 
 PostMon Aug 29, 2011 5:53 am
Send private message Reply with quote
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:
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!
  )
)
Display posts from previous: