tarek2's Recent Forum Activity

  • Analyzing that line you highlighted, this time in the first sequence, there is being stored in the new_sequence array, the order of the frames based on the variable seq1 and the order of the initial frames. You used (-1) to match the frame number since it starts at 0, right? Then, the value of the new_sequence array is passed to another variable (new_result).

    That's correct

    You are making progress but you're still missing the most important which is the thing that confused you as you try to copy my code exactly.

    This line of code is your issue as you still didn't understand the concept:

    Because my "seq2" starts empty = ""

    So repeat 4 times:

    First Loopindex:

    And I add the First number to "seq2" -------- Example = 2

    So to set the New Value in the Array Sequence I need the last number Added in "seq2" that's why I use -------------- int(right(Seq2,1))

    This will Pick = 2

    So we set the New Value at index = (2) -1 to match the Array index as it starts (from = 0) as you found out

    ===========================================

    Second Loopindex:

    And I add the second number to "seq2" -------- Example = 1

    So to set the New Value in the Array Sequence I need the last number Added in "seq2" that's why I use -------------- int(right(Seq2,1))

    This will Pick = 1

    So we set the New Value at index = (1) -1 to match the Array index again

    ====================================================================

    Third Loopindex:

    And I add the third number to "seq2" -------- Example = 4

    So to set the New Value in the Array Sequence I need the last number Added in "seq2" that's why I use -------------- int(right(Seq2,1))

    This will Pick = 4

    So we set the New Value at index = (4) -1 to match the Array index again

    =================================================

    Four Loopindex:

    And I add the Fourth number to "seq2" -------- Example = 3

    So to set the New Value in the Array Sequence I need the last number Added in "seq2" that's why I use -------------- int(right(Seq2,1))

    This will Pick = 3

    So we set the New Value at index = (3) -1 to match the Array index again

    =================================================================

    So far we have the Sequence modifier = 2143

    Now, where is your problem that I want you to find out?

    If you look closely you cannot use my code:

    int(right(Seq2,1))

    Because you already have the full Number = "2143" created Right?

    So instead you need to loop from the first number to the last one in order, the same way I did but with your own code, that's the only thing you need.

    I create the number on the fly and I pick on each loopindex the last number added but you already have your full number created so you should just loop through your "seq2" number to pick one by one in order.

    2

    1

    4

    3

    the same logic goes for (seq1/seq2/seq3)

    So in truth, the concept was just to loop through the Sequence number in order that's all, the only difference is I add the number and pick the last number and you will loop through yours without picking the last number and instead just do it by index order.

    ===========================================================

    So finally you shouldn't use:

    int(right(Seq2,1)) -1

    Should use something like:

    mid(sq1, loopindex, 1) -1

    Or pick the code you are more comfortable with as they are many ways you could do it.

  • Hi tarek2

    It's me again. Sorry about that :(

    I tried to use my variables, disabling the process of generating random values through the array first, and it didn't work. After that, the system generates several numbers "1" as shown in the print of the variable "New_Result".

    As I understand it, it only works if I generate these numbers randomly, right? As I already generated the values of the 3 sequences, I already disable this action. Maybe I need to add these values into the array, right?

    I don't want to be rude but I have to tell you this to help you:

    Your problem is that you not studying the example they give you that's why most of your threads get (3+ Pages) unnecessary. But I thought that by warning you on my first comment

    "I don't have much time to spend on this so I hope I get it right."

    I will make you try harder to try studying the examples but I see that it didn't work so let me try now differently:

    Lets us analyze what's going on here, how is possible that you need to study only two lines of code to understand what you need to do and still can't figure it out?

    The problem is that you spect users to give you exactly the example that will sync perfectly with your already started project which is impossible as we cannot see it so there's no way that anyone can get it right that way, so automatically your approach it's wrong. The examples they give you are for study and understand them and then you will be able to create your own version or integrate them into any projects easily.

    1-First Part: Starting Number:

    You said that you have your code already so you don't need to study that

    2-Sequence changers:

    You have 3 but in truth is the same code repeated three times so you need to just study and understand one of them to understand what going on.

    Lets Pick Sequence: 2

    You said that you already have your sequences done with your own code (seq1/seq2/seq3) so you don't need that either, then what is left?

    How the new sequence is generated right?

    That's just one line of code

    So if you think logically you need to ask what I'm doing in that line of code?

    I'm just looping through the numbers inside the variables

    "seq2"

    &

    "New_Results"

    At the same time and in index order to shuffle the positions of the numbers so you get the new Result at the end inside the "Array New_Sequence"

    Now if you look closely I'm creating the number "seq2" on the fly so my code will be different than yours as I'm targetting the last number added in "seq2" but your code has already all numbers created so what do you think you need to do? definitely, you cannot target the last number like me as your numbers are added already in your "seq2" so it will give you 4 times the last same number on your "seq2"

  • tarek2

    I can't understand one thing: in your script, you use 3 variables (Sequence1/Sequence2/Sequence3) and you store the corresponding Array values in these variables. However, I can't find it in the script when you use these variables.

    I think that in this case, I would just change the name of these variables by my variables (seq1/seq2/seq3),

    Because I update the "Sequence1" & the new Results at the same time, that's why I didn't need to reference that variable on that same tick, it was there for you just in case you need to reference it in your events to make it easier for you.

    It looks like the more I tried to make it easier for you including visual debugging the more it confused you so I removed all the things that weren't needed and:

    -Renamed the variables to your (seq1/seq2/seq3) names

    -I referenced your (seq1/seq2/seq3) variables to create the New result number

    So now you should have no problem, just take time to study the code as it's very easy to figure out what's going on so you can update your events.

    https://www.dropbox.com/s/rd4k2a0m7q4l86o/2-Sequence%20Numbers.c3p?dl=0

    Good luck

  • Hi tarek2

    Right in the bull's eye! That's exactly it. Thank you very much!!!!

    Np, glad it was helphul

    The only issue is that in the example the sequences are drawn, but in my case, I already have these values ​​allocated to variables (seq1/seq2/seq3). It is possible to change the script to use these values ​​instead of drawing them, right?

    The drawing sprites it is just for debugging, I tried to explain in my last comment:

    Also, you can remove the sprite events you don't need them they are just for visual.

    You can remove those events

    And Yes for the (seq1/seq2/seq3) you already have them in the Global variables the same as yours, you just have to rename them or copy the results into your variables:

    For example to save Sequence1 look at the (Event 12) (Action 2)

    And the result for that sequence after we modify the value Number is saved into Global "Sequence1_Results"

    The same goes for the other 2 sequences, they are all named exactly matching what they do so it should be no problem to identify them, or at least if I understood you correctly.

    The best thing is to open it on Debug mode as you will see the visually debug sprites on the screen then look at the Global Variables values on the Debugger and you should be able to identify what each variable does and then do your modifications.

    Note:

    Just remember to reset all the Global var whenever you start a new game session.

  • Is this what you need?

    https://www.dropbox.com/s/f58gszxn2ey79mz/1-Sequence%20Numbers.c3p?dl=0

    I don't have much time to spend on this so I hope I get it right.

    I created many Global Variables so you can debug and follow easily but you can change them as your like.

    The final number that you need you will find it on the Global Number "Final_Number"

    Is a string Number so you may have to convert it to an integer if you need to

    On Preview "For each sequence number" you will find the results next to it on the Right

    For example:

    Here the starting Number is "2310"

    And the Final Number after all the sequences are done is "1203"

    Also, you can remove the sprite events you don't need them they are just for visual.

  • 1-Your Array JSON Data includes extra symbols at the end of the Name "Values" that's why does not match the name that you are trying to spawn on the "LoadImage" Variable

    LoadImage Value ="beaucoup"

    Arra Value= "beaucoup\n"

    Remove the "\n" at the end of the values and it should work

    2-Also your second issue is the layer where your spawn the image "Back" you have it invisible by default so you not gonna see the image spawned unless you set it to Visible

  • Yeah I agree, I explained the same issue in the comments here:

    construct3-21h2.ideas.aha.io/ideas/C321H2-I-297

    Will be nice if the Hierarchy supports any type of object so we don't have to use the Pin for dragging objects as it has that issue that it updates one tick behind.

    Maybe we should open a new Feature request as dop2000 request it was just for the TileMaps though.

  • Sorry for the triple post but Disabling solid on 'player' has fixed the issue. No idea why this would make a difference but there you go.

    Honestly is very confusing on C2 they followed one system for years and on C3 they changed it so:

    On C3 if you have solid on the object it will not trigger the LOS

    On C2 however, if you have solid on the object it will trigger the LOS

    Here is an example:

    Using the last C2 Version

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

    -If you open on C2 you will see that it triggers the LOS by setting the Opacity for the black sprite

    -But if you open it on C3 it will not trigger, not sure why they don't follow one system

    The same thing they did with the Load from As.JSON they changed how the system works and they broke all the projects that use C3 R288 and lower unnecessary making people wasting time hours of work redoing all the events, not sure why they keep doing this as it's not professional at all.

    Here is the Link:

    https://github.com/Scirra/Construct-3-bugs/issues/5964

  • The Picture shows that you are looping through a 2D Array using the "For Each XY" but in the Conditions, you are just checking the First Raw (Y = 0)

    You will need to change both conditions:

    Value at (Self.CurX, Self.CurY) = fem_code
    Else: Value at (Self.CurX, Self.CurY) = mal_code
    

    Though you say you need to know the "Raw" but to get the Raw you need to target the "Y" not the "X"

    Basically I am looking for 2 values one is "mal_code" and the other "fem_code" in the first column

    The same thing I explained above if you need to check just the First Column you need to target (X = 0)

    Value at (0, Self.CurY) = fem_code
    Else: Value at (0, Self.CurY) = mal_code
    

    That will target just the first column though instead of looping the whole Array just to check the first column unnecessary you can just use the "For" Loop and check directly the first column. If you have a small Array then is ok you can still use your method if it's easier but if it's big then I recommend you to use the "For" Loop.

    Example:

    For "Y"
    
    From 0 To Array.Height-1
    
    Value at (0, LoopIndex("Y") = fem_code --------- Set fem_code = LoopIndex("Y")
    Else: Value at (0, LoopIndex("Y")) = mal_code ------ Set mal_code = LoopIndex("Y")
    

    This will check just the First Column

  • > > I'm making a game in which the ball will bounce continuously or forever. How can I make it?

    >

    >

    > The simplest way is to add to the Ball the Bullet Behaviour and set "Bounce Off Solids" True

    >

    > And don't forget to add the "Solid" behaviour to the walls or the objects that the ball will bounce from

    but at some point the ball stops bouncing

    No, unless you stop the bullet

    Here is an example:

    https://www.dropbox.com/s/sqcx3g40uelys2k/Ball%20Bounce.c3p?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply! Let me be a bit more specific:

    I have a dictionary containing in-game currencies. I'd like to use a text object to show these currencies.

    When adding a new currency to the dictionary, I'd like to add its CurrentKey and CurrentValue to the text object.

    If the text object already has such key, I'd like it to only add its CurrentValue.

    I hope this makes sense, I'm pretty stuck at this and it might be a suboptimal approach. If you have a better method I'm all ears.

    Thanks again.

    Instead of checking the Txt object if has the key you need to keep track of the Printed (Keys & Values), for this, I will just check if the Key exists will be much easier:

    Example:

    On Currency Check:

    --------- Dictionary has Key?

    -----------------If Yes: add the value to the existing value in the dictionary and then clear the Txt to Print all currency (Key & Values) again

    ----------------- Else Key Doesn't Exist: add the new (Key and Value) to the dictionary then Update the Txt object with a new line and print the new (Key & Value)

    This is so to avoid updating every tick the Txt object

  • I'm making a game in which the ball will bounce continuously or forever. How can I make it?

    The simplest way is to add to the Ball the Bullet Behaviour and set "Bounce Off Solids" True

    And don't forget to add the "Solid" behaviour to the walls or the objects that the ball will bounce from

tarek2's avatar

tarek2

Early Adopter

Member since 26 Jan, 2016

Twitter
tarek2 has 12 followers

Trophy Case

  • 8-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x5
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

15/44
How to earn trophies