Bound to Layout: MouseX/Y goes outside layout

0 favourites
  • 4 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • This might be intended behaviour, but I'm just not sure if I'm doing it right.

    I found that if I have a sprite and set the behaviour "Bound to Layout" and I create the sprite at -500/-500 on startup, the box is correctly restrained to the layout. If I also try and set the position manually it is restrained correctly. However, if I set it to Mouse.X/Mouse.Y it's possible to click near the edge of the screen and have the object poke outside the layout.

    <img src="" border="0" />

    Is there something different with the mouse behaviour I should be taking into account, or should this be working in all cases?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's odd, can you share your .capx?

  • I had same issue already few months ago, which i did report as bug.

  • Ah, I figured it out. I'm only taking into account the window size, not the layout size. If I set the window to match the layout size (eg. 1280, 1024) I can see the sprite being constrained to the layout.

    As the layout is often not the same size as the window, it's important to note then that some actions like destroying a bullet once it leaves the layout does not happen once it leaves the viewport, but the actual layout itself. In the case of huge layouts with scrolling worlds, these events might take a lot longer to fire than you expect.

    I wonder how many other people this has tricked <img src="smileys/smiley1.gif" border="0" align="middle" />

    Since we don't have a Bound to Window event, I'll have to figure out another way to constrain the sprite to the viewport.

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