[Open Source] Adventure Game Engine: INVENTORY!

0 favourites
  • 10 posts
From the Asset Store
10 Orchestral Soundtracks / ~2 mins each / 11 audio clips in total
  • EDIT: R0j0hound's new and improved version with MUCH tighter events! https://dl.dropboxusercontent.com/u/542 ... y_mod.capx

    Okay, it's based HEAVILY on the brilliant idea of AlexFrancois and I used his post example as a launchpad (here's the original post: how-do-i-make-a-simple-inventory_p934190?#p934190)

    I've hard-coded a lot of the stuff, so preferably a forum genius could tighten the code up and optimize it so it's more dynamic for folks wanting to use it without learning through the code, but here goes, v1.0 of the Z(ebbi's) A(dventure) G(ame) E(ngine) Inventory source! https://www.dropbox.com/s/cfbhwiuhjvbux ... .capx?dl=0

    Feel free to use it, if it's actually of any use to anyone, as you can see, there's a couple of variables to sort out the current page, I WISH I could have gotten modulo to work to decide how many pages there need to be (for instance, if there's between 1 and 3 over the remainder of a division of 4) but so far, this will work for up to 16 items, more can easily be added by adjusting the code.

    Hope it's of use, I'll keep working on the rest of the engine and sharing it as it's completed. PLEASE feel free to improve it and tidy the code and post you're updates, it could definitely do with it! <img src="{SMILIES_PATH}/icon_e_confused.gif" alt=":?" title="Confused"> <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing">

  • Wow, I'm gonna take a serious look at this. Thanks for sharing with the community, mate.

  • Wow, I'm gonna take a serious look at this. Thanks for sharing with the community, mate.

    No problem! Please do let me know what you find, any bugs or what not!

    I have the garbage bin there to remove items from inventory, as you can imagine it would be easy to use that function and switch it for whatever you need like, giving an item or using it, just click the item on the bin to remove it

  • Thank you for sharing this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem! Maybe a genius like R0J0hound could take a look at how easy it would be to turn some of the hard codes more dynamic, things like the array events for each object should be able to be selected by the name of the sprite, and somehow work modulo into the expression so it only makes a new page if there's 1-4 items over each division of 4? (I'm probably being cheeky asking for this! :p )

  • This will give you the maximum scroll value:

    max(0, ceil(count/4)-2)

    If you're setting the animations like this:

    For each inventorySprite

    --- set animation to array.at(loopindex+scroll*4)

  • This will give you the maximum scroll value:

    max(0, ceil(count/4)-2)

    If you're setting the animations like this:

    For each inventorySprite

    --- set animation to array.at(loopindex+scroll*4)

    Just a quick heads up to thank you, I'll be implementing it as soon as I figure out what the hell I wrote last week!

    EDIT: Seems to work so far! I'll add the other shortly...

  • R0J0hound

    Having a slightly hard time working this one out:

    I need to figure out the X size of the array dynamically, at the moment it's kinda hard coded and I need to work out how to test for a change in the size of the array to correspond to the pages/slots?

  • I don't quite understand what you did with those events and the "but" variable. Best I can tell you're setting it up so it controls when the scroll buttons can be used.

    If it helps here's the capx I did to figure out that expression above and work out how things could be simplified. As I said I didn't understand that bit so I did it a different way.

    https://www.dropbox.com/s/l8hw93anmoofu ... .capx?dl=0

  • I don't quite understand what you did with those events and the "but" variable. Best I can tell you're setting it up so it controls when the scroll buttons can be used.

    If it helps here's the capx I did to figure out that expression above and work out how things could be simplified. As I said I didn't understand that bit so I did it a different way.

    https://dl.dropboxusercontent.com/u/542 ... y_mod.capx

    I think I was trying to figure out which page the player was on and set the height, but I couldn't work it out with maths so I used some silly variables, I really appreciate you simplifying this!! I estimated it could be done in under 30 events but you took it down to 19, wow!! <img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked"> <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    I really appreciate this, I'll update the main post with this version!

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