ErikSwahn's Recent Forum Activity

  • Glad you are here lionz! I have tried to put these principles in but I think I am missing something fundamental.

    Here is a screenshot of what I have constructed so far. The item on the ground is destroyed but no item appear in the bag when I test. NONE means empty, not NONE means filled. The global variable called "itemslot" is just the current selected one, which should swap a filled slot. This should happen for a selected slot if all slots are filled. Itemslots currently start from 3 and reach 5, since first slots are for specific gear.

    picallow.com/events-2

  • When I pick up an item, I want to fill an empty slot. If I have 3 empty slots upon picking it up, just one of these must be filled instead of all 3.

    Since all the slots are same object and differentiate themselves only with a variable (1,2 or 3), I find it hard to check them all at the same time. If slot=1 is empty and slot=2 is empty just does not work since a slot is not both 1 and 2 at the same time. So I need to separate them in conditions and perhaps check them in steps.

    My mind want to structure it like this:

    if item picked up

    slot=1

    slot=empty (set to filled and stop checking)

    slot=2

    slot=empty

    slot=3

    slot=empty

    if item picked up

    slot=1

    slot=filled (check next)

    slot=2

    slot=empty (set to filled stop checking)

    slot=3

    slot=empty

    Does sub events solve this? If so, how should I structure it?

  • Thank you for the explanation! In that case I will make the layer non global and rework some things. It is better that way.

    Cheers :)

  • It worked but now I have a new problem. Since the objects are global and belong to a global layer, another object is created when I transition between layouts. So if there are 6 itemslots, they become 12 when I enter a new layout.

    If I move the object to a non global layer it fixes this but I have some other reasons for them to stay on a global layer. Is there no other fix to this? Should I remove the persist behaviour?

    Appreciate the help!

  • I have some object sprites that symbolize equipment. They all have a number for which slot they are. "Slot 1" for example is the weapon slot. The weapon is set depending on what "Slot 1" contains (what name a variable has).

    If slot1.name=none set weapon to "none".

    When I pick up a weapon it sets slot1.name to the weapon.name (shortsword).

    Which sets slot1.name=shortsword.

    All these objects are on a global layer and they have persist. Yet they reset to their original state if I leave a layout.

    So each time I leave a layout, slot1.name becomes "none" which is it's default state.

    How can I fix this issue?

    EDIT: I noticed when I went back to a layout I picked up a weapon in, it saved that state. But why does it not bring this state over to another layout?

  • Excellent. Thank you :)

  • Sorry I work in C2.

    Could you perhaps take a screenshot on what you did?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah I get it. This will for sure work with my little system. I am not used to loops though. Can you suggest a way to structure it for me so I know how it should look? An image would be enough.

    Thanks!

  • I have a family called "ItemSlot" with a variable called "ItemSlotNumber". I have placed 6 ItemSlots in my layout, each having a unique number in the ItemSlotNumber variable.

    (1,2,3,4,5,6)

    I also have a global variable called SelectedItemSlot and a sprite called SelectSprite

    If ItemSlot.ItemSlotNumber=SelectedItemSlot

    Every tick, set SelectSprite X to ItemSlot.ImagePointX(0)

    On Left Arrow Key Pressed, subract 1 to SelectedItemSlot

    On Right Arrow Key Pressed, add 1 to SelectedItemSlot

    However. If an ItemSlot is empty, I want the next non empty slot to be selected if pressing left or right. It must be able to skip several slots if required. Is there a smart way to do this without having to brute force every possible scenario through events? Note that I do not want to implement an array this late in the game's development.

  • That was it. Thanks!

  • I have a family called "characters", with a family variable called "ready". When ready is 0, characters stay still and when ready is 1 they start moving.

    I want characters to start moving when they are on screen, and stop when they are not.

    For each characters

    -sub event: is not on screen = set ready 0

    -sub event: trigger once

    For each characters

    -sub event: is on screen = set ready 1

    -sub event: trigger once

    If 3 enemies are on screen, only 2 of them start moving. Why?

  • You do not have permission to view this post

ErikSwahn's avatar

ErikSwahn

Member since 15 Jul, 2014

Twitter
ErikSwahn has 1 followers

Trophy Case

  • 10-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies