dop2000's Forum Posts

  • You just need to keep in mind that newly created instances may not be immediately available in other events. Example:

  • Do they work in other (non-construct) games? Do they work in preview? Have you tried NWjs export?

  • You can add Touch object to the project and use Touch.AngleAt(0) and Touch.SpeedAt(0) expressions. They should work when dragging with mouse too. For example, this is dragging to the right:

    Sprite is dragging
    Touch.AngleAt(0) is within 30 degrees of 0
    Touch.SpeedAt(0)>100 
    
  • I had the same issue and I've seen several people mentioning this - editor.construct.net/r317-2/ opens r327 instead.

    In my case it resolved itself somehow.

    You can try clearing browser cache/data.

  • + FileChooser: On changed
    -> Sprite: Load image from FileChooser.FileURLAt(0) (Resize to image size, cross-origin anonymous)
    

    The image will replace the current frame. So you need to set the right animation and frame in your sprite first.

  • It's hard to troubleshoot without the project file. "For each devices" with the condition where you check for ObjectTypeName should work.

    Where and when do you run this event? Instances in C3 are not created immediately, sometimes you need to wait until the end of the tick to be able to access them from other events. If this is the case, add "Wait 0" before running that event.

    I suggest debugging such issues using Browser Log action. For example:

    For each devices : Browse Log "Iterating devices UID=" & devices.UID
    
    .. devices.ObjectTypeName="foo" : "Picked device:"&devices.ObjectTypeName
    
    etc.
    

    Open the browser console and check the messages there.

  • This is the fourth time you are asking the same question. Please read this post:

    construct.net/en/forum/construct-3/how-do-i-8/best-help-tips-forum-139528

  • There is an official example in C3:

    editor.construct.net

  • 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

  • I don't understand the problem. You can still pick family instances by object name. And use Family.ImagepointX/Y

  • I am using dictionaries.AsJSON inside of arrays, and then the arrays are stored as JSON inside another array

    It's a very inefficient way to store data, like you said escaping " with backslashes is probably making 80% of the entire string. I don't think compressing the string with zlib will magically reduce its size from 30KB to 1KB. I suggest you change the way the data is stored. Use just one array or JSON. Don't nest JSONs inside of JSONs inside of JSONs.

    In this game many thousands of objects are stored in a single JSON file. I'm using a string like this, which is pretty compact and easy to read:

    {
     "island1": {
     "objects": [
     {"o": "Tree,animationname","x": 100,"y": 200},
     {"o": "Rock,animationname","x": 405,"y": 112}
     ]
     },
     "island2": {...}
    }
    
  • It depends on how levels are built in your game and what information you need to store in the string. For example, if there are three object types players can place on a 50x30 grid, then you can encode the entire grid into a string 1500 characters long, where letters A-C represent an object and a dot represents an empty cell:

    A.A...BAC.....A.B..CBB.ABC.CCB....

    Another totally different approach is to upload the string to an online service like Pastebin.com

    When you upload a string, you get a unique URL, which can be used to download this string. So people can share and exchange URLs in Discord, instead of full strings.

    Both uploading and downloading from Pastebin can be done with AJAX.

  • One thought is to put all my sprites into a family and then trying pick last created [family]

    This is the right method, I use it all the time.

    I tried doing a for loop from 0 to family.AllChildCount but this only returned a single iteration of the loop. It is not properly counting (or detecting) the family's children.

    AllChildCount expression is related to hierarchies. Family "children" are usually called members, and unfortunately there is no way to get a list of all family members in events. You can make your own list of members, for example with an array.

  • oosyrag haha, I too still learning basic things about Construct. A few weeks ago someone told me that the default order of instances is based on their zIndex, not on their UID or the order they were added to the layout. I always thought that an instance with IID=0 is the instance with the lowest UID. (facepalm)

    By the way, the order of conditions is especially important when using "For each" loops. I prefer picking the instances first, then iterating them, I believe it's better for performance:

    Enemy is on screen
    Enemy is overlapping Zone
    For Each Enemy 
    ......
    
  • I believe you can echo this variable in the php. And then in your Construct project you will be able to get it in the AJAX response. Use "On AJAX completed" event and AJAX.LastData expression should contain that value.