Jump to content

Defining a clickable area


Recommended Posts

I am making a little game that is similar in style to the Covert Front point and click adventure games (http://www.mateuszskutnik.com/covert_front/index.php?id=cf_1). Navigation is pretty easy, you click on doors, and sometimes parts of the bottom of the screen to move between them. Here are some screenshots from the Covert Front game to illustrate the type of thing I want to do:


In the first one you can click to go back when the cursor is near the bottom of the screen, and in the second one, you can change rooms by clicking near the bottom, or either door.

I made a simple prototype where I navigated using arrow sprites, as seen below, which worked well and were easy to use. However, I would prefer not to have buttons like this.proto.jpg

I was wondering what the best option would be to define clickable areas for movement. Should I create transparent sprites to define the doors and use the OnInputDown event as I did in the prototype, or would it be better to use a Rectangle, and check each onDown event to see if it is contained in the rectangle? I am wondering if there is a preferred method for doing something like this, or whether there are methods I have not thought about.

Link to comment
Share on other sites

Yeah, the sprite way is fine. I would set the alpha property to 0 like you said. That would be the easiest way, a lot of other ways too, but performance here is not an issue whatsoever so you should be good! :)


Edit: Infact, I do this same method with my tiled maps for making interactive NPC's / objects.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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