dop2000's Forum Posts

    You don't want to use instance variables and you don't want to use arrays. I don't have other suggestions for you..

    I suggest using instance variables. See this example.

    Or copy all results to an array and sort it. Array -> Sort action

  • 4.7GB used by images is quite a lot! Definitely something that needs to be optimized.

  • I had a project that was over 8GB.

    yuiiella What happens when you click preview? If there is a black screen, press F12 and check for error messages in console.

    You can also open Task Manager and check how much memory the browser is using.

    Put them into an array and use Array Sort action.

    Or if these values are stored in instance variables (for example, Position instance variable on Car sprite) - you can do:

    For Each Car order by Car.Position descending
    .. Text append Car.Name & " " & Car.Position 
    
  • - set value at (0,0) to Food //name of the item 2

    Did you mean set value at (1,0) ?

    To list all items from the array you can do this:

    Repeat array.width times
     Append text: "-" &array.At(loopindex, 0)& " " & array.At(loopindex, 1) & " " & array.At(loopindex, 2) & "$ " & array.At(loopindex, 3) & "kg" & newline
    
    
  • GetAsBeautifiedString() expression returns a portion of JSON as a string, which contains key names and values, with quotation marks "" and line breaks. These special characters need to be escaped with "\" if you want to store them in JSON as a string.

    To be honest, I don't understand what you are trying to do. If you want to copy all values from "Equip.0" into "Item", use Set JSON action:

    JSON Set JSON: "Item" to JSON.GetAsCompactString("Equip.0")

  • Your events 26-27 can potentially run on every tick. And you have "Wait" action in them. This can cause serious problems.

    My guess is that the issue you are having is caused by that Wait action - even when the condition becomes false, all delayed actions from previous ticks will continue to run for 3 seconds! And if you reset isFinished to false in some other event, these delayed actions will continue to set it to true for 3 seconds.

    Use Timer behavior instead of wait - Timer runs per instance and can be stopped or paused.

  • You do not have permission to view this post

  • when I used the action to set collision cell size to 10x10 it reduces the checks down from 125000 to 800.

    This is insane! I wonder if collision checks actually work correctly with such heavy optimization.

    Ashley Could you comment? 125000 to 800 seems too good to be true.

  • So I tested again and here are the results:

    There are 1000 instances of sprite A and 1000 instances of sprite B. Animation frame is set to 1 for half of them.

    250K collision checks per tick - collision cells are working.

    125K collision checks - collision cells are working. And it's more efficient because we eliminate half of A instances.

    500K collision checks - collision cells are NOT working.

    Test project:

    dropbox.com/scl/fi/u8tlp28lh0fj87yh1n6n9/coll_cell_test.c3p

  • The way you are using functions is very wrong. Functions should be at the top level, avoid nesting them under other events or conditions. Also, "Every X seconds" inside the function won't work.

    And that chain of functions calling each other is completely unnecessary..

    Say, you want to spawn a new wave of sharks every 2 seconds. And each wave should contain 5 more sharks. Then you can do something like this:

  • Yeah, you are right! With no sub-events I get ~430 iterations. With two nested sub-events only 163

  • You are adding children to Button family. It should be "ButtonNormal add child ButtonPressed".

    Even if Button and ButtonNormal is the same object, Construct treats the family as a different object in events, allowing to pick family instances independently from object instances.

    Also, the second event should probably look like this:

    Cursor is over ButtonNormal 
    Cursor Left button is down
    .. ButtonNormal pick child ButtonPressed : ButtonPressed set visible
    Else 
    .. ButtonNormal pick child ButtonPressed : ButtonPressed set invisible
    

    And by the way, while hierarchies is an awesome feature in Construct, in this particular case it would be better to use a container instead. Then both objects in a container will exist as a pair, creating one will automatically create another, picking one will pick another and so on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads