How do I unlock abilities when picking up item ingame.

Get help using Construct 2

Post » Sun Mar 05, 2017 4:32 am

I achieved a nice double jump with a few conditions and actions thanks to a tutorial and of course i have it on my event sheet.

How can I make that ability start to being used by the player once pick ups an specific item ingame? what's te way to go here? as a rookie I'm struggling to find the right approach.

Thanks in advance!
B
12
S
4
G
2
Posts: 8
Reputation: 1,816

Post » Sun Mar 05, 2017 7:17 am

If it's a small number of abilities the user can use (e.g. like the inventory of a point & click game) you can add the player object N instances variables (e.g. abi1..abi9) used as flag for the unique ability.
You should use an boolean for each ability (non/available).

- key ability = abi1=true
- hammer ability = abi2=true
...

The objects/tools representing the ability ingame should have also an ability-ID storing the representing ID (key = 1..N)
Once 'collected/activeted' the represented players ability ID is set to true.

--------------------------------

If you have a lot of abilities ore code it more dynamically you should use an array of abilities and give each ability an ID (1..N).
Add the ability ID to the array if 'collected' or delete the ID if it get lost.
Same approach here:
The objects/tools representing the ability ingame should have also an ability-flag storing the representing ID (key = ID1)

mercuryus
Image Image Image
B
42
S
22
G
15
Posts: 376
Reputation: 12,223

Post » Sun Mar 05, 2017 8:58 am

Global variables are better in this instance than what mercuryus suggested, as instance variables will reset/delete unless you have an object set to Persist. Global variables persist across layouts and dictionaries can be used to store the flags for them across sessions.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 529
Reputation: 19,610


Return to How do I....?

Who is online

Users browsing this forum: NN81 and 24 guests