Infinite Canvas?

0 favourites
  • 3 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • 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.

  • I may not understand the problem, why do you mention canvas?

    If you need an infinite layout, then simply enable the unbounded scrolling and that's it. You can scroll to a position like (1000000,1000000) on start of the layout to avoid dealing with negative coordinates.

    Enable "Scale Inner" or "Scale outer" full screen mode in object properties, and remove the Set Canvas Size action.

    Use Mouse.X and Mouse.Y (not AbsoluteX/AbsoluteY) expressions to get mouse position in layout coordinates.

  • 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 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)