Jump to content

Simulating a click with a keyboard press


Martiny
 Share

Recommended Posts

I'm wondering if there is a way of simulating a mouse click (or touch) on a sprite with a keyboard press.

 

For instance, imagine I have two images, both with a function that when I click on them, the sprite I clicked gets killed.

 

click_example.gif

 

 

I wanted to click "1" and the first would get killed, and then "2" and the second would get killed. I guess the easier way to achieve this is to simulate a click event in the corresponding sprite when I press '1' or '2', but I don't know how to do it.

 

 

Is there a way of simulating a mouse click in a specific position (x and y) or on a sprite by a keyboard press?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...