mardoch's Forum Posts

  • It's working! Thank you!

  • Oh yes you'r right, my mistake. But even corrected, it doesn't delete all the datas. My purpose is to delete everything in the X axis but also in the Y, like 0,0 0,1 0,2 and 0,3

    These are my saved values, and I want them to be deleted:

  • Hi everyone,

    I actually try to delete a data in my array but don't really know how I can do it. My array is width 0 and Height 4 and I recorded my object's Json in it plus 3 variables like UID and my ObjectTypeName.

    So it's look like this in my debug inspector (btw how can I see all the informations as the bloc can't be resized?) :

    I want now, after a trigger to delete the corresponding object in my array.

    I was thinking about looking for every X element in my array with the corresponding UID name, saved as a variable:

    Unfortunately it doesn't work. Maybe I forget something?

    Thanks for your help!

    Tagged:

  • I have been working on this for 10 days now and I wanted to share it with everyone!

    The idea is simple: generate a new room as the player choose in which direction he wants to go. And of course the mini map.

    Ok it seems to be a really common thing but the tricky part was to make the new rooms fit the already created ones. So the directions are always logical and possible: you can't join a room if there is no entrance to it.

    Here was my method:

    1 • In and Out Directions

    I need to check the actual in/out direction on the screen and create or load the next room as the player touch it.

    2 • Create Boards

    If the next room doesn't exists, it creates a new one according to the table NextBoardCreation.json loaded in an array. The table is big as there is a lot of possibilities as the player wants to go up, left, down or right. I also needed to check if the are already created rooms touching the next one.

    My table fro the rooms creation

    3 • Load Boards

    If the room exist already, I want it to be saved on an array. So it can be charged again if the player comes back in the room.

    4 • Map & Type of Board to create

    This was the big part of the work in the end.Beside showing the player his actual position, it helps for creating the next rooms with 2 types of detectors: the first range are the ones very close of the actual room (up,left,down,right) and the second range are there to check if there are actually some other rooms existing around and give information about it, like if there is an entrance to those rooms.

    You can access the file here:

    dropbox.com/s/5w9ad59vq7cd6lt/LevelGeneratorFinal.c3p

    As you can see, it works pretty well.

    Of course I'm sure it's not perfect. I'm not a dev and maybe there is a better method to do it or to optimise and reduce number of lines of code.

    I will be happy to hear your suggestions or impressions about it. And there is also more to do to make it even better, so feel free to custom it!

  • Thank you again tarek2

    I highly recommend you first read how the events work before you carry on or you will have many issues like that, which will make you spend hours debugging or changing Events unnecessarily.

    In fact I did know how it works and I usually test my event with the keyboard key press trigger. I don't know what I did and why it doesn't worked well last night, I was probably too tired to use my brain correctly!

    Anyway, thanks again for your help!

  • Just another quick question: When I get my second value, let say that I also want to put a Z dimension in my array (like 2 depth). So I can select a random dimension between 0,1 and 2 with different values for my selected cell. But how can I make the loop stop?

    For now I did something like this but the value change at every tick:

    + System: For "Y" from 0 to Array.Height-1
    ----+ Array: Value at (0, LoopIndex("Y")) = Variable1
    -----> Text: Set text to Array.At(1,LoopIndex("Y"),Array.CurZ)
    -----> System: Stop loop
    

    So do I have to make another loop for the "Z"?

  • Oh great! Thank you! I just realise my main mistake, even when I tried to reproduce it, was this:

    3-In your Goblal variable "Variable1" you entered the wrong value:

    1|0|1

    Because there is one character missing at the end as in your Array you have:

    1|0|1|

    So it will never trigger the match, make sure you always put the exact value.

    I couldn't figure it out without you.

    Thank you so very much!!

  • Maybe it's time to share the file?

    Yep definitely the time because I can't make it works. Here is my file:

    dropbox.com/s/otrysy1ehg3cvdh/ArrayTest.c3p

    But I was also thinking that maybe I did my table the wrong way. I can make it more simple as the values I'm searching are the same for the columns 0,2,4 and 6.

    I can probably put my values (the ones identical as my Variable) on the first row and all my seconds values (the ones I want to display in the text bloc) in the 4 next rows like this:

    More easier. (Btw, is it ok to rename the Y column as I did?)

  • Ok sorry, I get it. So let me explain exactly how I want it to be:

    • First I have a variable for column 1, I need to check in my array at column 1 where is the matching value (For example if my variable is 1|0|0, I want it to check where in my column the same value is. I only need to check the 1 column because that’s my variable for it).

    • When the value match, it stops the loop and picks the value on the second column (if my value is located in the cell x3, y0 I want it to pick the value in cell x3,y1)

    • Then I get this second value that I want to display in the text bloc.

    I though that this method with array is the easiest way to do what I want but maybe I'm wrong and there is something more simple?

  • My last example was just to check that there is no problem importing a value, sorry I'm just a beginner with the arrays.

    But my purpose, as you noticed earlier, is to match my variable with the value of the first column and then pick the value on the next column.

  • Yes, I'm pretty sure that my table is well imported in the array:

    I did also tried to disable the second event, just to check:

    + Array: For each XY element
    + [DISABLED] Array: Value at (Array.At(Array.CurX), Array.At(Array.CurX)) = Variable1
    -> Text: Set text to Array.At(1,Array.CurY)
    

    It only display "D", the last cell of the column 1.

    So I can say that it's supposed to work, bu it doesn't.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I already tried this, but my text is still unchanged.

  • Hello!

    I'm still trying to use array for different things each time and here is my new issue.

    I have to beautiful table.json that is actually displayed in an array.

    I also have a corresponding instance that is one of the values in the column 0,2,4 and 6.

    My objective is the check in my array, in the column 0 for example, the corresponding value. And then, getting the value from the column 1, same row.

    (As this for more clarity:)

    So I'm dealing with this code to get it done:

    + Array: For each X element
    + Array: Value at Array.At(0,Array.CurY) = MyVariable
    -> Text: Set text to Array.At(1,Array.CurY)
    

    But of course it's not working…

    I think the problem is with this line

    + Array: Value at Array.At(0,Array.CurY) = MyVariable

    but I really don't know how to deal with it.

    Also, maybe my method with this is not the good one. I thought using array was the simplest thing to do…

  • Yes that's it!

    Here is the good version:

    + System: Every tick
    + MapInOutCheck: MapInOutCheck = "upleft"
    + System: Pick MapInOutCheck where find(",ULDR,LDR,UDR,ULR,DR,UR,LR,R,,", ","& MapInOutCheck.TypeChecked&",") > -1
    -> MapInOutCheck: Set Entrance to True
    

    Thanks for your help!!

  • Your first solution is working fine.

    The second one with the find expression looks great and more elegant but it seems there is an extra " somewhere…