Multiple Keystroke Events

0 favourites
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • the only issue i've noticed that... even if i turn the whole layer invisible.

    The Mouse-Over the items still works.

    But i guess i can find a solution for that.

    The inventory system from Yann isn't the easiest for a beginner....

    Still found no way to actually add an item to the inventory upon pickup for example xD

    Or how to actually equip something.

    But that will require some more research from my side.

  • Yes, even if layer is invisible objects on it can still interact.

    I've been always dealing with that using one global variable "Inventory" and placing everything related in sub-event. Like on the image

  • Yea but my game will feature multiplayer as well.

    So i guess i can't use global variables, can i?

    Or would global variables also work, due the fact that the global variables are NOT synced unless i tell them to sync them?

    I'm not sure about that.

    Till now i've always used object based variables if i wanted to make them work for multiplayer peers.

    But your function calls look interesting.

  • Can't get multiplayer to work on my network so never bother to sink in to that, yet.

    As of functions... yeah Functions are your best friend.

  • Just to add a little clarity, I believe the reason the wait is needed is because the way C2 works, all events are played once a tick, in the order they appear in the event sheet. The top event sets the inventory to visible, but for this tick 'I' is still being held down, so it triggers the next event down. The wait0 command means the inventory state is not changed until the end of the tick. I think I have that right, please correct me if im wrong.

    Hope this helps your understanding and if not I can expand further.

  • I'd recommend if possible putting all events pertaining to the inventory in a group and enabling/disabling this group along with the visibility..

  • Yes, that's a very good suggestion, (so obvious that I forgot to mention that).

    This will simply make sure when Inventory is not visible to not run any actions related to it. Events under disabled groups are omitted by engine, which lead to better performance if you have a lot of events.

    Also you can split your project to different event sheets and include them only when they are needed.

  • So like

    if keystroke "i" pressed, activate group ~ wait 0.1 -> so it will run the events

    and if keystroke "i" pressed again simply deactivate the group and it will vanish?

    But i wonder... if the whole group is deactivated, won't that destroy all instances of my inventory so the next time i open it all items will be resetted?

    But that sounds like a great solution for me if i want to reach better performance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess you have your inventory set up either with variables or an array or something like that, so that wouldn't be an issue..

    And even if you haven't you shouldn't have to destroy anything, for you can just set the layer invisible and all actions (like button-push) disabled through the grouping, so actually nothing changes on the inventory layer..

    and the wait action shouldn't be necessary either in my opinion..

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