mardoch's Forum Posts

  • You should probably try to reload the file. I just try it on another device and I can open it without any error.

  • Hello everyone!

    I'm actually working on a game which include sometime, a king of duel happening.

    The idea is quite simple, you have to kill the AI before it kills you. It's quite the same gameplay as TowerFall Ascension. Just to give you a global idea.

    I didn't found anything about how I can code a similar AI on the forum or as examples. So I did something that's work a bit for now, here is the capx.

    This file is just an extract from my main project, so some stuff doesn't work like the AI avoiding player's bullets.

    But as you can see, the AI sometimes is acting a bit crazy or is stuck on a wall or can't climb a platform.

    So I would love to have some advices about how I can manage my AI code or if any solutions already exists. Maybe my method isn't the simplest or the good one.

    Thanks you all!

  • You right, I shouldn't us this variable. And I didn't knew about the reversed animation speed. Just updated the file, now I guess it's definitively optimized!

  • Hello everyone,

    I just create a charging button. The idea is to press a button for 2 seconds to validate an action, like in many games.

    Here is the c3p file here.

    It works very well but maybe there is a better way to do it. So I'm curious about any suggestion that can simplify it.

  • Ok I just get it. I was using the Dictionary in a totally wrong way.

    I used to add the instance variables directly in the dictionary proprieties so I didn't have any key in it. I did't created a Json file fist with all my keys and values.

    So here is what I was supposed to do first:

    + System: On start of layout

    -> AJAX: Request MyDictionaryFile.json (tag "Dico")

    -> System: Wait for previous actions to complete

    + AJAX: On "Dico" completed

    -> MyDictionary: Load from JSON string AJAX.LastData

    And now this works fine:

    -> Text: Set text to MyDictionary.Get(MyArray.At(Object.Line,0))

    Maybe it to should be noticed in the manual…

  • Here is a screenshot, maybe it's easier to get where my problem is:

    I also tried something different. First I save my item name in a local variable, so it's exactly the same variable name recorded in my dictionary. Then I compare the variable's names to get the corresponding value (a number in this case)

    But even like this I can't get my value…

  • Hello everyone,

    I have some variables and values in a dictionary and I would like to compare the variable to an entry in an array.

    For exemple in my array I have an entry like "Item_Name1", then I want to get the value from my dictionary with a variable named "Item_Name1"

    I'm actually doing something like this:

    + MyDictionary: For each key

    ----+ MyDictionary: Key MyDictionary.CurrentKey = MyArray.At(Object.Line,0)

    -----> MyDictionary: Set text to MyDictionary.Get(MyDictionary.CurrentValue)

    Object.Line is supposed to give the current X value.

    The Y (0) is the entry I want to compare ("Item_Name1" for my exemple)

    Seems that it can't get the value because it returns "0"

    Any suggestion?

    Thanks!

  • Yep that's it, thanks a lot!

    I thought that "Array.CurValue" was used for every entry entries in the Y column…

  • Hi, I have an object with different variables and boolean that I saved in an array in the right place like this:

    Then when I reload my layout, I would like my object variables and boolean to be set like it was saved in my array. So basically, I check if my ObjectTypeName match with the one saved in my array then I set the JSON to saved data like this:

    But it doesn't works…

    As you can see I have this line I created to test it:

    -> [DISABLED] Vendors: Set Mission_Id to SavedVendors.At(SavedVendors.CurX,2)

    And it worked fine.

    Maybe it's not the good action for this, so I definitely need some advice about this…

    Thanks!

  • Your logic is correct! I finally make it works perfectly:

    Once again thank you lionz for your great advices and help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think i just get what you mean:

    The array deletion row you don't need to cycle through the array again as you are already at a row in the array and can delete the current row 'loopindex'. The problem with this however is that rows will move up and some objects will be skipped, to resolve this sometimes you can run reverse through the array from bottom to top.

    Seems that it delete also some other datas…

    I'm not sure now that my code line delete the correct data row

  • Thanks! I didn't know that!

    So now it's working, I can finally create my requested planets sprites on the map. So here is my last move, if I want once the planet is created, delete it from my array:

    + Planets_Array: Value at (0, LoopIndex("Y")) = PlanetSpriteSelected

    -> Planets_Array: Delete index Planets_Array.CurY from Y axis

    This seems to works fine but it seems that if I repeat my function like this:

    + System: Repeat 3 times

    -> Functions: Call CreatePlanets (SetType: 3)

    it make some clones of my planets, even if they are deleted.

    Do you think it will works better if I repeat the creation of the planets directly inside my function? Like with a variable?

  • I get it, now my code looks like this and it's supposed to work correctly:

    But it doesn't. Seems that the problem come from this line

    -> System: Set PlanetSpriteSelected to AdvancedRandom.Weighted

    as it don't copy the data in the variable. I tested it also not as a local variable but as a global variable and the is "0" instead of the sprite's name as it is set on the table.

    I also try to test it when i click on the mouse button but the result is still the same.

    I really don't know where the problem is because I already used a similar code in another sheet and it works very well.

  • Ok thanks, that was the issue.

    So now I'm getting close to what I want to do. I can save in my advancedrandom probability table the datas with the corresponding set.

    Now, is there a way to shuffle this table? so I can take a random entry (the last of the table for exemple) and create the object.

    I don't even know if this solution is a good way to do what I want in the end…

  • I see, so even when I try little I can see there is a problem with the advancerandom table. If I ask it to add the entry from the array, it doesn't work

    And still my Array is loaded correctly. Non sense…

    It understand that there is 25 entry but won't display the datas from it