0 Favourites

Endless side scrolling

  • When you moves camera in some strategy game, it stucks in the border of game map, but what if camera will move looped?

    Like this:

    <img src="http://s3.hostingkartinok.com/uploads/images/2013/11/9be570cfc20b00f5c587ce1a2ff80b1d.gif" border="0" />

    Any ideas?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • If you've made an interface layer (i'll call it UI) with parallax/scaling set to 0, you can use that to get the right mouse coordinates, and then compare that against the Border size/thickness

    Var: Border = 50

    If Mouse.x("UI") is greater than ViewportRight("UI")-Border --> scroll right

    If Mouse.x("UI") is less than ViewportLeft("UI")+Border --> Scroll left

    and do the same for Top and Bottom

    edit: ViewportLeft("UI") and ViewportTop("UI") should always be 0

    so you can do this instead:

    If Mouse.x("UI") is less than Border --> Scroll left

    There are other expressions to use instead of ones i've mentioned above, such as: WindowWidth, Mouse.AbsoluteX and CanvasWidth.. but I would avoid these because they can give different results depending on browser/device settings.

  • I'm not asking how to make side scrolling, I want make map borderless. If you will scroll camera to the right and as soon as you will reach border it won't stop, map will just shown from begging. And same thing for every direction.

  • this is psuedo of course and you will need fine tune.

    If(Camera.X > limit) camera.X = 0

    If(camera.x < 0) camera.x = limit

    do the same for Y

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