How do I centre the view port

  • Hi All,

    I'm running in to an issue with the view ports location.

    I'm creating object at random points outside the view port.

    My issue is that objects created on the right and bottom are within the layout, so they get created, but objects created in the top and left are outside the layout and view port and thus the objects are destroyed before they enter view.

    I need to move or centre the view port so that I can continue to create objects on all sides of the view port, without the objects being destroyed immediately.

    Any help or ideas appreciated.

    Regards,

    Jon.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The center of viewport could be calculated by :

    X = (ViewportLeft(0) + ViewportRight(0))/2

    Y = (ViewportTop(0) + ViewportBottom(0))/2

    0 is your layer number.

  • Thank you for the response.

    Not quite what I need though. I need to move the view port to the centre of the layout instead of the top left.

    Regards,

    Jon

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