Skip to main content
Participant
February 3, 2014
Question

How do I make a button work in a specific area on the canvas only?

  • February 3, 2014
  • 1 reply
  • 483 views

I'm making a Minecraft-Terraria style mining game, and I have a pickaxe tool. I want to make it so it can only be triggered over a certain area or position. How would I do this?

PS. If it uses coordinates, how would I find those?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 3, 2014

you can use a hitTest with a shape that you place on the stage or using coordinates.  if you use coordinates, you would use the pickaxe._x and pickaxe._y values.

BenningsAuthor
Participant
February 5, 2014

Sounds good, do you have any idea how I would do that? :/ I'm a bit confused.

kglad
Community Expert
Community Expert
February 5, 2014

which one?

there are 2 different suggestions.  using coordinates is easiest to use but only works well if the area is rectangular.