WixeyWinsock's Forum Posts

  • Hi,

    Thanks for the advice. The only reason I used push front was because push back resulted in the items displaying identical animations when created in the inventory.

    I have a very limited understanding of arrays so although I can see how using the items' X array variable will work I don't know how to set it up. Could you (or someone) please upload a small example, as I find visual aids make things easier to understand?

  • Hi,

    I've run into a problem with a simple inventory system. When an item is collected it appears in the inventory's item slot, but the first slot is always filled with a sprite displaying the default animation instead of whatever the actual item is. The subsequent items display correctly, but are always one behind the currently collected item. I can't work out if it's an issue with the inventory array action I'm using or with the JSON file.

    https://drive.google.com/file/d/1FWt_LkNIcdUCUbaTrcluHZcf3tLk-C1A/view?usp=sharing

  • Hi DiegoM,

    Thanks for the advice. I'll go with the first option as I doubt I'd be able to get the second option working (maths and logic were never my strong points, though I have an analytical streak).

  • Hi,

    About a year ago I made a simple 'what character are you' style quiz with

    16 possible results. Every now and again I got some feedback and found people always got the same result. I've tested it multiple times and have found you can potentially get other results, but it's almost impossible due to the clunky method I was using.

    The quiz consisted of eight questions, each with two possible answers. Every time a question is answered, the answer is stored in sequence as a global string, for example if the person answered 'A' for the first six questions and 'B' for the last two the string would look like 'AAAAAABB'.

    There's also a global number that increases by one every time a question is answered, moving to the results layout when the eighth question is answered.

    The results were determined by the global string sequence. The problem is only one or two string sequences give one of the 15 results, with the 16th result being the one the player gets if the string doesn't match any of the sequences for the others.

    What could I change so that players stand a better chance of getting more varied results, other than manually adding loads of separate answer sequences? I can upload the C3 file if it makes things easier.

  • Just out of curiosity, would it be possible to make the above setup in Construct 2?

    I don't have much experience with it other than a few small test projects and installing a JSON plugin, but found I couldn't replicate the "floor(random(0,JSON.ArraySize(".items")))" action - I kept getting an "ArraySize is not a expression or instance variable in JSON" message.

  • Hi oosyrag,

    Thanks again for the link, I've finally got everything working.

    I'm in two minds about whether to stick with json as although it's been a good (though tiring) learning experience, I doubt anyone else will be working on this project other than me so arrays would be the better choice as I have a small amount of experience with them compared to json, which I'm completely new to, but have been struggling to work out what events to change in order to get the same setup working with arrays.

    Having said that, I think I've got enough to work with for now so switching to arrays isn't essential.

  • Hi oosyrag,

    This is the setup I'm currently using. The json file contains the id, animation name and description details for each item. Maybe I'm using "Get" wrong, as spawned items always have "0" for ID and the default animation. I tried setting a random ID but this only worked for the first item; the others IDs constantly cycle through 0-9 and the animation was still the default one.

  • Thanks oosyrag. I eventually got it to work using push to front for the sprite animations and set value to (0,1) for the ID. I'd also forgotten to add ",1" after the CurX for the ID.

    One last thing. When I spawn items randomly on the item layout, is there a way to generate the correct ID instance variable for each item? So far all generated items have an ID of 0.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi oosyrag,

    Many thanks for the link, it's been a big help.

    I've run into a problem with a variation of this setup where I collect items on another layout before combining them. I'm trying to store individual items' ID instance variables and current animations in an "inventory" array,

    but on moving to the combining layout, it either displays the correct animations or IDs, but not both. I expect I'm not using the right "push back" actions on the item collect layout (see below):

    I might not be using the correct "set to" actions on the combining layout either:

    I've tried "push back Item.AnimationName&Item.ID" but this sets all the items' IDs to "NaN".

  • Hi oosyrag,

    Maybe I'm doing something wrong but I can't find the link to the updated example. The previous link downloads the original example, which only has 10 events.

  • You do not have permission to view this post

  • Hi oosyrag,

    Many thanks for clarifying things. For the drag and drop, I was trying to make it so that only the first instance of an item could be dragged into (for example) a pot, and any identical items in the inventory would temporarily have drag and drop disabled until after a recipe was successfully created.

  • Hi oosyrag,

    Thank you so much for this, it's extremely helpful and I think I'll be able to use this for the project. I'm still experimenting with it and have a couple of questions:

    Which json file is the item list one, as they both contain item lists?

    If there were duplicate items on screen, how could I ensure only one of each item has drag and drop enabled?

    Is there a (fairly) simple way of tweaking this so that item order doesn't matter, as it sounds useful but beyond my abilities to code at the moment?

  • Hi oosyrag,

    Many thanks for taking the time to explain this, it's been a big help. Just one question - in event 7, why do I need to set the Used variable to True for both the Item family and the Item object? I accidentally deleted one of the "Set Used to True" actions afterwards and found it still worked.

  • Hi oosyrag,

    Many thanks for all your help. The project's still too early in development for me to have a really clear idea about the interface, but once I've given it more thought I'll post a sample image and description when I have time.

    If I decide to stick with drag and drop I doubt I'll use more than three items as I could see it was starting to get overly complex.

    In the meantime, here's my attempt at adding a third item. I've added the "For each item family" but still can't get them to combine.

    According to debug mode the "ID2Valid" and "ID3Valid" variables don't always switch to "True" when overlapping the other items.

    drive.google.com/file/d/12kvwVJnoTaVl5K5gLJEllirUFHkhvmPy/view