How do I make my 'shop' work?

1 favourites
  • 3 posts
From the Asset Store
50 front view of buildings JPG - residences shops and offices - 2048x2048
  • C3/Mobile game

    I know why this doesn’t work, but I know I'm close.

    The player earns coins. With the coins the player can purchase different items.

    When the item isn’t available it is covered by a semi-transparent sprite. The cover over the items has 2 animations, one is the cover, the other is a check mark after the item has been purchased.

    It almost works. When I press the coin sprite, I add to the coins.

    When I click on the cover, I am able to purchase the product, but when I leave and come back to the shop the program has purchased all the products. That’s not good. I only want to purchase one product at a time.

    Any idea how to fix that?

    This is a demo I made trying to figure it out:

    drive.google.com/file/d/1Ezg2vIARXVk5to_ptWwZQoIHavOGU95W/view

  • To me it looks like it is changing over to Animation Frame #1 on all of the "spr_invCover" Objects, when you have the 10 coins, and click on any of the items. They all cost 10 coins, and all are using the same "spr_invCover" Sprite Object. It's not actually picking any unique ID on the item in the shop being clicked, so every object is being changed over to Animation Frame #1.

    I'm not super proficient with Construct yet. But, that is what I'm seeing looking at the screenshots you've posted. As always, there are many ways that this could be fixed. Hopefully someone smarter than me will jump in with a really efficient fix.

    EDIT: For example you could make sub conditions depending on which item is clicked, only have that "spr_invCover" Sprite changed to frame 1, then have the item added to the inventory. Or you could setup a UID system, so it finds the UID of the item, and only changes the frame on that item, then adds the item to your inventory.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for your reply.

    I have this feeling I need to setup a 'for each' and store the UIDs somehow.

    After trying several different things, I can make it work as long as the game doesn't close, but I can't seem to store which covers have been opened and which are still unavailable after the game is closed.

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