netdzynr's Forum Posts

  • I'm wondering if there's any benefit/efficiency to be had when using one central mouse-handling event, versus having separate mouse handlers for explicit events, controls, etc.

    In other words, is this...

    on mouseclick

    test for situation 1

    do something

    test for situation 2

    do something

    test for situation 3

    do something

    ...any better/more efficient than

    on mouseclick & situation 1

    do something

    on mouseclick & situation 2

    do something

    on mouseclick & situation 3

    do something

    I currently have a project set up using the former arrangement (one central mouse event handler) and it's becoming increasingly unwieldy and difficult to manage the code. So can I consider breaking up the handler into separate individual mouse events, or would it be bad to have, say, 20 separate mouseclick events all tracking the mouse at the same time?

    Thanks in advance for any enlightenment here.

    Tagged:

  • Is it possible to export (and later re-import) the objects of a single layer?

    I'm looking to save various object arrangements into external files, and then read any of the saved files back in and create/arrange objects accordingly.

    Is there a way to use Construct's existing JSON structure for this, or would I need to loop through layer objects and build my own lists?

    Tagged:

  • Thanks for the response. In answer to your question, I used the term "canvas" to describe the result I was after, but I get that's also an object type.

    I've implemented several of the suggestions you offered, though I wasn't able to get scrolling to work without using absolute X/Y coordinates. Regardless, the behavior seems to work fine.

    FYI, the project I'm building is essentially a browser-based web app, so I'm trying to keep the display of content at full scale, regardless of browser window dimensions. Turning off full screen mode seems to accomplish this.

    Thanks again.

  • I'm trying to set up what would essentially be an infinite canvas that can be drag-scrolled in any direction without end. Of course, this can have practical limits if needed, but the goal is to make something similar to a canvas layout area similar to Figma or Sketch.

    I'm looking to create these features:

    - (near) unlimited space

    - canvas fills screen when browser is resized

    - user controls stay fixed at edge of browser window during resize

    I put together a model which seems to do the above, but I'm wondering if some kind soul can take a look and see if there are better ways to set this kind of thing up in Construct.

    https://www.dropbox.com/s/jdqhjfstqod1nay/Infin8%20Canvas.c3p?dl=0

    For one thing, the controls bounce and jiggle when the browser window is resized, which I can live with, but is there a better method for anchoring the controls and/or handling the resize of the browser? The bottom label doesn't seem to stay anchored properly?

    Is it reasonable to start with a layout that's 20,000 px square or even larger? Can a layout be dynamically resized if needed?

    Also, I enabled unbounded scrolling for the main layout, but when scrolling to the 0,0 (left/top) origin, the viewport seems to reach a limit when it can't scroll any more. Again, if the layout is large enough to begin with, this limit is not a huge deal, I just don't know if this is the best way to set things up.

    Thanks for looking.

  • Thanks. Appropriately, the sample code is yours 😉

  • I see this in a demo file I've been reviewing, which is setting the value of a variable. Is this an if/then/else statement?

    b1 >= 0 ? (b1 - b1%50) : (b1 - b1%50) -50

    Tagged:

  • A quick update to this thread...

    Currently, creating the arrows as hierarchies seems to work well. They can be positioned in layout view as single objects (same as containers set to "select all"), they can be resized while maintaining their isometric perspective, and they can be moved as single objects at runtime without any laborious pinning required.

    So far so good, hoping I don't run into any additional issues. 🤞

  • Thanks again for your suggestions on this.

    I would happy to use regular sprites, but the arrows are skewed to isometric angles and need to resizable, set to any random size in the layout, which is why the arrow bodies are made using 9-patch and tiled background objects (the arrowheads need to stay at fixed dimensions). AFAIK, there's no way to stretch a sprite (besides a simple line) along one axis without distorting it, is there?

    The use of containers makes it easier to treat each arrow as a single object in the layout. Sure, I could manage all the resizing/aligning behavior in code at runtime, but that means I'd have to build an entire editing system that saves and reads in all the arrow/object sizes and positions from external files, a fairly non-trivial amount of work.

    Anyway, I was also looking at using scene graphs as an option, so I guess I'll give that a try.

    Thanks again.

  • Thanks for the response. To explain more, I have a dozen containers that each contain 2 objects -- they're essentially stretchable arrows with a shaft and an arrowhead. Multiple instances of these containers appear throughout the layout, and I can't figure out how to iterate through the containers to pin each set of contained objects. AFAICT I can't simply reference an object type or name because multiple instances of those objects exist in the layout.

    The way I see it, I need to somehow determine that an object lives in a container and then pin it to its corresponding object in the same container.

    Or is there another way to approach this?

    EDIT: Adding a link to an example layout:

    dropbox.com/s/21aolu9os7jttxm/arrow_test.c3p

  • I need to pin several family objects together within containers, so the contained objects can be positioned as a group. How can I iterate across all the containers in a layout and reference the objects contained in each?

    It doesn't appear that I can use IIDs as the contained objects are from families and matching IIDs appear in separate containers.

    Thanks for any suggestions.

  • Wow, that's fantastic oosyrag, thanks so much. I'm guessing this is a Construct version of the article you posted from the ClintBellanger site?

    Looking around the net at other isometric game examples, I assume most people use the 2:1 ratio of tile dimensions because it's easier to do the math. Interestingly, in the illustration field, isometric art is generally more often created using 30° angles, presumably because 30 is an easier number than the 26.57° that's needed for 2:1 tiles.

    Next I'm hoping I can adapt the info from your isometric z-order project.

    Thanks again for the example.

  • Thanks for the helpful responses, but I'm still not able to work out the math.

    I'm using a grid that's based on a 30° angle, so a slope of 0.577 (or gradient of 57.7%). Apparently substituting those values in the formula doesn't work, or I didn't set up the values correctly?

  • Thanks for the response. The challenge I'm having is that the target grid points are offset because of the isometric arrangement, as opposed to standard horizontals/verticals.

    Can you point me to an example that shows what you suggest?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've seen a few examples of object/character movement on a grid using directional controls, but is there an example that shows how to use drag & drop or similar to constrain the movement of a sprite to an isometric grid?

  • Anyone know how to do this, or if there's an example of this somewhere?

    Thanks.

    Tagged: