How do I unlock abilities when picking up item ingame.

0 favourites
  • 3 posts
From the Asset Store
Unlock Levels, Worlds & skin plus add coins by watching ads
  • 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!

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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