Inventory with only ONE object

Just started using Construct 2? Post your questions here

Post » Fri Aug 22, 2014 8:05 am

Hi All!

I've been experimenting with Construct for a simple Adventure Game i'm planning and here's what i'm trying to do (it's a Platformer Style Layout but without any jumping):

My Player Character should be able of carrying only ONE object at a time. It goes something like this:

Character Picks up Key - Key goes in the Inventory and is destroyed in the Game World

If a Character decides to pick up the pie, the key gets dropped back in the Game World at the point where the Character is standing, the pie gets destroyed in the Game World and appears in the Inventory.

If however, the Character uses the Key on the Door, the Door opens and the Key gets destroyed permanently.


Do you know of a good way to achieve this?

My next step would be to give my character sprites multiple, separate Arms which are holding the different objects. So if your key would be in the Inventory you'd see the Character carrying it, same with the pie, etc. I thought about just doing the arms as separate sprites and then call them and let them follow the Players X and Y Coordinates.

A very good example of the kind of thing i'm trying to do is this little Flash Game by Double Fine called Host Master Deux: Quest for Identity. You can play it for free on their Website, if you're interested. Thank you so much for your help!

- Joel
B
18
S
7
G
2
Posts: 112
Reputation: 2,203

Post » Fri Aug 29, 2014 12:21 am

"Character Picks up Key - Key goes in the Inventory and is destroyed in the Game World":
If Inventory = 0
MOVE it (x,y) to other place you call inventory. It can be outside the screen area or a interface.
(now your inventory = 1)

If inventory = 1, you cannot pick anything else.

"If however, the Character uses the Key on the Door, the Door opens and the Key gets destroyed permanently." - Destroy the key
B
33
S
5
G
1
Posts: 163
Reputation: 2,698

Post » Fri Aug 29, 2014 6:47 am

Hey Scofano

Thanks for your reply. The problem is, i'd like the player to be able to pick up another object, even when he already has one in his Inventory but then they get switched out.

So if the key is already in the inventory and i add the pie, the key returns to the game world and the pie wanders into the inventory.

However, maybe i'm just making too big of a hassle out of it. Maybe i should try something with the pin function and make it like a Super Mario-picks-up-the-shell-and-carries-with-him function. I can't find any good tutorials on it unfortunately but maybe i'm looking wrong....
B
18
S
7
G
2
Posts: 112
Reputation: 2,203

Post » Fri Aug 29, 2014 10:51 am

Your Mario / pin guess can be a fine way.
B
33
S
5
G
1
Posts: 163
Reputation: 2,698

Post » Fri Aug 29, 2014 11:33 am

See the comments in the capx.
I don't really have time to comment right now, though it involves picking that you may find more about in the "How do I FAQ".

Leave me a warning if you want me to explain further more (Write @Kyatric in your post)

I went directly for the "two arms" inventory as it is what you want in the end.
For "simplicity" sake, I also went for two keyboard keys. X and C, each one taking/handling objects for each arms.
You do not have the required permissions to view the files attached to this post.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
293
S
117
G
96
Posts: 7,310
Reputation: 71,069

Post » Mon Sep 01, 2014 7:36 pm

Thank you so much @Kyatric! I'm going to look into it more thoroughly when i get back home from holiday but looks just like what i need! Now i just have to do some reverse engineering to figure out how it works exactly but i think thats a rather good learning exercise ;) Thanks again!
B
18
S
7
G
2
Posts: 112
Reputation: 2,203


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests