Code occasionally misses an array value entry [SOLVED]

1 favourites
  • 4 posts
From the Asset Store
5 levels with simple coding Source-code (.c3p) + HTML5 Exported
  • Hi all,

    I have a game engine I am working on. It is a simple procedural level gen with platformer behaviors. Each room has 2 doors (except the first) Each room number acts as the random seed. (Using advanced random) You can go between rooms. The exit is always lowest - right room.

    I am attempting to save the changes in an Array, Dict, or token and then re-apply them when you come back to a room.. this also works... Except i noticed occasionally an array entry would be missing. I tried using an Array, Dictionary, and token solution, but to no avail. They all miss the same value. This led me to believe that that issue is not with the array but with my code.

    I tried making it not delete terrain until I verify the array to ensure the value exists... this is why i am so confused. I verify the array value exists but even then it is occasionally not written. I tried adding a green overlay so i can see the Terrain Changes array real time.

    • left stick left and right
    • Gamepad A = Jump
    • Right Stick aims rock saw
    • Left Gpad trigger starts saw

    Sorry.. right now all I have is gamepad support. and i hope the jump is high enough to get around. I took a lot out of the game to attach this.

    Hoping someone know what i messed up?

    ***There is a section call "Rock Saw" that handles the level destruction and storing of arrays, dicts, and tokens

    DROP BOX TO c3p

    https://www.dropbox.com/s/gdl6nm1c5j2o66g/SEED.c3p?dl=0

    Thanks,

    Gillis

  • Try adding a “for each stone” after the condition that checks the health.

    Without it if multiple stones have a health less than zero, only the first will be saved.

  • That fixed it ROJO. Amazing.. This isn't the first time you've bailed me out. Thanks a lot!!

    Gillis

    Check it out:

    I think I learned how to do bitwise from you and you helped me with pathfinding too. Thanks again!

    Subscribe to Construct videos now
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You’re welcome. Glad it solved it.

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