How do I Create In-Game Shop

Get help using Construct 2

Post » Tue Sep 15, 2015 4:42 pm

Hello everyone, I hope all of you are in good spirits. I stopped in to ask a question on something I've been working on for several months now. The game is developing very well and I have caught on to Construct 2 pretty fast. The problem that I'm having is how to create an in-game shop. I have reviewed the How to from 2013 and I have successfully built that example following the instructions. What it lacked was how to integrate it within the game itself instead of building a layout where buttons are pushed. No disrespect to that author but I need more details than that.

Here is the scenario: A player collects coins all through the game trying to save up to buy an item from the in-game store or shop. The player buys that item of his or her choosing, and it deducts it from player's coins. As I stated earlier, I have the game built and I have to be honest it was brutal. I just need to see template or something on how to set this up. Nothing to complex because I am a beginner...lol

Thanks,

Frank
B
10
S
2
Posts: 9
Reputation: 880

Post » Wed Sep 16, 2015 12:14 am

I am not sure what part or if as in a whole you need to see something setup. I don't have that but i can offer what i would do to set this up. Also assuming this is a single player game.

Players gold would be the global variable. can modify it anytime in the game then.

The shop would multiple layers, in its own scene, where one side is players inventory (bottom interactive layer, just above the background stuff.) and then the other side the shop screen. Can use a book with pages or tabs to have the shop layers go visible or invisible. If you do tabs then every time a player clicks a tab first set all shop layers invisible and then the one they choose to visible, some headache avoided. Once you setup one shop layer it is copy and modify. The easy way of doing a shop is tab method with item picture and a buy button. Each button can be the same sprit, as with the item picture, but have a variable with the item name and price. then code will be somewhat like the following.
When player clicks on buy now
player gold = player gold - buy now price variable
add "buy now item variable" to player inventory.

When they do purchase something from the shop they click the buy button next to the picture and it deducts the gold and then adds it to their inventory. I do not know how you have your inventory setup that will be all you. You should have this setup first before you set up the shop and if so you should have some idea of how to add items to in in code. There are several different inventory how to's out there.
B
3
Posts: 4
Reputation: 183

Post » Thu Sep 17, 2015 3:14 am

@Nubelite thanks for your insight. Right now I only have 5 items that can go into the store. Your correct it is a single player game. Sorry for the lack of information but this is my very first game design so a long with learning C2, I'm also learning how to be detailed with my questions because its so many ways to get the same results in C2.

So, let me see if I understand what your instructions are: Are you saying create a shop layer on the main layout and copy that to other layouts as the player progress through the game? Then create a tab/buttom to set the layer visible or invisible. I'm going to explore this method more.
B
10
S
2
Posts: 9
Reputation: 880

Post » Thu Sep 17, 2015 9:29 am

If you need, you may make the shop layer a global layer through your project, this way you only need to add/modify it in a single layout and still will have access to it in the various layouts of your project.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,317
Reputation: 87,483


Return to How do I....?

Who is online

Users browsing this forum: ksiads, Mayfly, R0J0hound, RozekEnhance, tarek2 and 3 guests