How to..

This forum is currently in read-only mode.
  • Hi,

    I have 2 objects on a layout: a player and a mouse pointer sprite.

    The player and the mouse pointer sprite both have the "center view on me" setting.

    So the view tries to keep both the player and the mouse pointer on it.

    But it havn't limits: if I want my game on a window, when the mouse go out of it, the view center on the mouse pointer and the player is out of the view.

    How can I limit the movement of the mouse by a certain range?

  • Try limiting the pointer's movement so it doesn't leave the screen. You can do that with clamp(), like so:

    + Always
        -> Pointer: Set X to clamp(MouseX, ScrollXLeft, ScrollXRight)
        -> Pointer: Set Y to clamp(MouseY, ScrollYTop, ScrollYBottom)
  • Thank you deadeye, it works.

  • bumped because its been [solved]. for better search.

    "center view on me" objects game window.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • it's probably not a good idea to keep bumping old thread's because they are solved

    it shouldn't really make a difference in searching

    almost all old threads are solved.

    if you want to post solutions in a useful way, try making wiki articles or posting to the tutorials section

    I'm not a mod...but, I'm probably not the only one who doesn't want to see old posts when I see a forum has new posts on it

    know what I mean?

  • yea, try not to bump old threads. And what do you mean for better search? This thread will just migrate back down when new ones are posted, so it doesn't make sense to bump it to keep it visible.

    "center view on me" objects game window.

    sorry I really don't get the meaning of this.

  • actually last time i had to search for something it went into 30+ pages. thats happened more than once and many are actually not solved btw. some questions come up repeatedly because of hard to find solutions. you are right tho.

  • We should make a pinned topic in here with a list of FAQ, with links to threads so you don't have to rely on the 'search' thing only.

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