Should I use sprites to build my marketplace menu or can you define clickable zones in an image?

0 favourites
  • 7 posts
From the Asset Store
A well commented template with list menus and shops to use in your top-down RPGs or metroidvania games!
  • Hi all

    Hoping someone can advise as to the best approach here. I will have a "market" in my game where the user clicks buy or sell for approx. 8 different types of item. Should I create 16 sprites (buy and sell for each) and add events (to increase / decrease that product amounts and the players money amount etc) or can I use a single image and define clickable areas?

    I.e. it would be nice if I could draw a nice single image with all the buttons included and then define clickable zones that then respond accordingly, or does Construct 3 not offer a feature like that?

    Thanks!

    Ross

    Tagged:

  • If you designed it that way then yes. Seems it would be easier to design it with one buy and sell button and you navigate between items. Depending on how you stored the items you could use one event for all items even with many buttons.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks lionz - yes I could do it differently. I need the user to see all the items, their price, how many are in stock and how much they have all at the same time, as there will be some maths involved... I could still do that though with one buy and one sell and the 8 items listed, with the user highlighting one.

    Anyway... is that a "no there isn't a zone feature"? I'm sure that's how I did it once many years ago - crikey, 28 years ago! , in AMOS Basic - you'd define clickable areas on the screen / your background image.

  • I think no because the sprite object has one collision box. If it was one object but you need to click on different areas then you wouldn't be able to detect. You could overlap it with invisible sprites but in that case you may as well create them separately.

    You can put the group of sprites into a container and when you create one object it creates all related objects but I'm not sure if this is useful for a shop, you may as well create everything in the layout.

  • Thanks again. In this case, it will be easier to handle it slightly differently and use sprites.

    Just thinking of future examples though (and trying to improve my understanding of what is possible and what's not in C3), for example, if you had an image of a till, or a calculator. It'd be a pain to draw all the individual buttons.

    Is it possible to get the x,y co-ordinates of a mouse click / touch (will be a mobile app) in the event sheet? You could then carry out the action dependant on the exact location of the touch on the image (which would still be a sprite object, just a large one) - i.e. if x is between 10 and 30 and y between 80 and 100 you know that it's the area of the image that equates to the plus button, if it's another value its this button, etc etc?

  • You can also use invisible helper sprites overlapping a single other sprite, but usually for animations you want separate sprites for your buttons.

    You can also do what you said and define areas for clicking, but that is super clunky and inflexible and you'd just be wasting your time.

  • Ok thanks, that does indeed sound clunky! I think the best way for me to do this will be to have a layer and a background image and then a second layer with individual sprites on it for the "buttons".

    Thanks both for your help :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)