How do I make an in-game shop?

Just started using Construct 2? Post your questions here

Post » Wed Mar 08, 2017 7:27 pm

So,I'm working on this small Shoot-'em-Up and want to make an in-game store,where you use your score to purchase new items like bombs and missiles.
I want to make it so that you can,while playing,press a key,like 5,and lose 1500 points but get your new item immediately.
However,I can't seem to find a way to 'unlock' the item,It only works when the Player gets the item right at the beggining of the level.Anyone know how to do in-level(?) shops?
B
3
Posts: 2
Reputation: 179

Post » Wed Mar 08, 2017 8:18 pm

Hey - Sounds like you've done some legwork with getting the shop set up but are having issues unlocking items (based on experience?) as well as updating what items the player has currently.

I'd recommend using Local Storage and an Array for unlocking items (what's available in the store).

I may be complicating things a bit, but I'd also have a separate array for items the player currently has, which should be updated/loaded with local storage as well.

Here are some tutorials:
https://www.scirra.com/tutorials/5343/h ... -game-capx
https://www.scirra.com/tutorials/307/ar ... ers/page-2
https://www.scirra.com/tutorials/583/ea ... g-an-array
B
65
S
38
G
24
Posts: 352
Reputation: 18,006

Post » Thu Mar 09, 2017 1:22 am

For each item in the shop set frame 0 to a locked item symbol and add an instance variable.
Each level completed add 1 to a global variable (I'll call it "level" for this comment).

On start of layout item.variable is less than level 》 set frame to 1
On item clicked if frame is not 0 》 give the item to player.

To check if frame is not 0, just use compare frame then toggle invert.
B
25
S
16
G
26
Posts: 125
Reputation: 16,103

Post » Mon Mar 13, 2017 6:47 am

Ball shopping example : https://dl.dropboxusercontent.com/u/659 ... _bola.capx
[ excuse non-english content ]
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Sun Mar 26, 2017 9:36 pm

could you reapload "Ball shopping example" because link is dead ;/
B
5
Posts: 16
Reputation: 245

Post » Mon Mar 27, 2017 12:23 am

@rs2322 here it is >> https://www.dropbox.com/s/cquiv058on7w3 ... .capx?dl=0
You can summon me by include @alextro in your post.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Wed Apr 05, 2017 7:35 am

DevourerOfTacos wrote:So,I'm working on this small Shoot-'em-Up and want to make an in-game store,where you use your score to purchase new items like bombs and missiles.
I want to make it so that you can,while playing,press a key,like 5,and lose 1500 points but get your new item immediately.
However,I can't seem to find a way to 'unlock' the item,It only works when the Player gets the item right at the beggining of the level.Anyone know how to do in-level(?) shops?


A shop like in this game

https://www.scirra.com/arcade/action-ga ... ights-7569
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 682
Reputation: 16,615


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest