Canvas, Layout, Window, and While loops...oh my!

0 favourites
  • 1 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • I'm trying to run an experiment where the window size - I presume that's the view of the overall layout - is gradually resized right there in the browser window.

    For instance, if the width of the window is 500 pixels, I want to gradually made that width expand...501 pixels, 502 pixels, 503, 504...until I reach a certain value.

    My first question is simply what is the difference between the "canvas", the "layout", and the "window". As I said, my understanding is that the layout contains the whole of the current level or room or HUD. The window, however, is what can be SEEN of the layout at any given time, whether in part or in whole. But in the C2 editor under System, it mentions the canvas. Is that a reference to the layout, the window, or is it entirely something else?

    Per my experiment, I put in the Event tab:

    SYSTEM On start of layout (This I tried both toggled on and off...)

    SYSTEM While

    SYSTEM WindowWidth < 1250

    --> SYSTEM Set canvas size to WindowWidth+1 x WindowHeight

    The initial layout size is 1280x1024.

    The initial window size is 800x480.

    Again, I want to try to make the window through which the game is viewed to perceptably widen until it reaches my desired value. Like a window the size of a box, for example, expanding to that of a rectangle.

    Running the layout only left problems...rather, it didn't actually load. Certainly not as I hoped. I didn't even see a window in the first place.

    Another problem I have is that a different test using the While loop seems to complete instantaneously even when I add that Wait 1.0 seconds action into the mix while the condition is still true. I wanted a variable to increment by 1 while the value was less than 500, adding a one-second delay between increments, and to display the value of the variable immediately after each increment. AND! Even after adding a 10-second delay at the start of the layout before the While event still yields a text display for the variable's value as 500, or even 5000! I see no increment progression...even a fast one. Just instantaneous.

    Can someone help me clarify what the differences are between canvas, layout, and window are (if I'm at all mistaken), and give me a hint/direction on how to accomplish my goal, please? Just a hint...I still need to learn this on my own, too. And to explain to me the nature of the While loop as it's in action?

    Thank you so much!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)