GG-'s Forum Posts

  • 14 posts
  • A "Has Animation" condition for Sprites would be so useful!

    exactly that's the condition I was looking for which seems construct 3 doesn't have it.

    I also vote dop2000 idea

  • You could use something like this

    This example would pick the dragonfly animation

    As far as I know the second parameter in tokenat must be number

    would you explain what is the second parameter(background) and how it would pick the dragonfly?

  • Hi guys!

    I just want to know is there anyway that I can search the animation names of a sprite and if the animation name contains specific numbers or characters set that as a parameter (for example) for "Set Animation"

    for instance:

    Fluids_Sprite has these animations:

    12_Coffee

    13_Water

    14_Moonshine

    and I want an expression that search through these animation names and if one of them contains 13 set that as parameter for "Set Animation"

    I've tested this expression but it's not appropriate

    find(Fluids_Sprite.AnimationName,str(51))
    
  • Try and download this it may help you

    https://www.construct.net/en/free-online-games/tetris-inventory-41808/play?via=c18

    Awesome!

  • Here's one possible solution.

    For each of your items you'll want to store a "mask" of what squares it occupies within it's rectangle. So for a gun it could be:

    1111
    1000

    So when you drop an item into an inventory you'd only need to see if the 1 places were unoccupied as well as inside the array. If all the 1 were then you could then place the object in the inventory.

    Here is an example without arrays, although you could certainly use arrays instead. I'm just using "is overlapping point" instead of an array lookup. It handles placing and removing items, as well as throwing them out if they are placed in an invalid spot. Perhaps some of the ideas here are useful.

    https://www.dropbox.com/s/tpwx74fq1c43auc/Fit_shapes_into_slots.capx?dl=1

    THX, I'm going to see if I can implement it with array or not

  • Did you understand the first file you copied and how arrays work though? The problem with copy and pasting from files is you might not know what's going on so you need to understand it for when you encounter bugs.

    Yes totally

    This is my project you can take a look if you don't mind

    MY_INV.c3p

    my project also has an array which reads data from json then spawn the item sprite in the SLOT (if you check project file you can easily understand) but I also don't know how I can say spawn an item which fills several elements in correct postion like this picture

  • The way I would do it would be to know the size of the object and if it's 1x1 then it goes into the co-ords that you click but if it's 5x2 like the rifle there then you could get the starting co-ord and make sure they're all blank 5 across and 2 down from the starting point, then if so you would fill in all those array slots with the rifle item.

    Thanks for your response

    I worked on it for a few hours but it seems it's little bit much harder than I thought

    I would be appreciated if someone could share an example file

  • Well, I've made an inventory system like this image and my code is just like the inventory example on construct 3 start page

    Right now, I want to make an inventory which can store items with different size (like the below image), but I have no idea what should I do and how can I handle this with arrays?!

    I would be thankful if you guys explain what should I do or share an example file

    Tagged:

  • So, I'm going to try 3D arrays.

    Thank you guys for the suggestion!

  • Hi guys, I need a help with my inventory system

    Look at the below image as an example

    My inventory system is like this and I use arrays in my project and the code is just like the inventory example in construct 3 start page

    In my game there are many chests with items which I want the player loot them

    my question is:

    should I use separate arrays for each chest in order to store the item IDs and other data (is this efficient way or not?) or that's better to use another method?

    THX

    Tagged:

  • Hi guys

    So, I have an array in my project that I want to reads its data from a json file if sprite.StorageName equivalent to the array name in the json file.

    unfortunately, I don't exactly know how to write this in json and what events I should add in construct

    My json file is like this(I don't know if it is in appropriate form or not)

    {
     "c2array": true,
     "size": [
     5,
     4,
     1
     ],
     "Cabinet_A": [
     
     [
     [1, 2, 3, 4],
     [1, 2, 3, 4],
     [1, 2, 3, 4],
     [1, 2, 3, 4]
     ]
     ],
     
     "Cabinet_B": [
     
     [
     [4, 3, 2, 1],
     [4, 3, 2, 1],
     [4, 3, 2, 1],
     [4, 3, 2, 1]
     ]
     ]
    }

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You do not have permission to view this post

  • Hi guys

    I want my array checks if there is any "1" in each cells and change them to 0

    My event is this but it doesn't do what I want!

    Tagged:

  • Thanks!!!!🤝

    Actually your previous post helped me and I fixed the problem.

    But as you mentioned ,that is a really good way to do that

    I will be thankful if you gave me any ideas to this in a better way.

  • Hi guys!

    I added some events for 8dir rotation

    For example

    When The "W" key is down Player will rotate 2 degrees toward 270 angle

    But the problem is that for example when the player angel is 90 and I Press "W" with "D" the player rotate more than 2 degrees(faster) toward 315 angle

    But I defined to rotate 2 degrees toward 315 angle

    .CAPX file

    i will be grateful if you guys help me

  • 14 posts