How do I make the camera move like in RTS games?

0 favourites
  • 8 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • hi

    so yeah how can i move the camera when my mouse reaches the edges of my screen?

    also how exactly a Layout is working and why the "window" border is always on top left? is this the camera? can this move? can i have huge Layout as "maps/levels?"

    thank you for your time in advance.

  • One way is to have narrow invisible helper sprites anchored to each edge of the screen. While cursor is overlapping, move another invisible "camera" helper sprite that has the scroll to behavior enabled on the desired direction.

    The dotted viewport outline is to provide a reference for the visible area in the layout editor.

    Layouts can effectively be as large as you want them, as long as you manage your memory usage reasonably.

  • .....While cursor is overlapping, move another invisible "camera" helper sprite that has the scroll to behavior enabled on the desired direction.....

    hi thanks for the reply...can you elaborate on the above a bit with a screenshot or a demo of Events?

    still just new in this only few days so i dont know all the controls and what they can do :/

  • Try this beginner tutorial: construct.net/en/tutorials/beginners-guide-construct-1

    It will teach you about the camera and the viewport ("window" border at the top left)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this beginner tutorial: construct.net/en/tutorials/beginners-guide-construct-1

    It will teach you about the camera and the viewport ("window" border at the top left)

    coooool! thanks so much for this.

    this website has very bad google indexing, i cant find any of those tutorials when i google them.

    anyway. thanks so much! :)

  • Here is an example project - dropbox.com/s/34svcvglv9sr5kv/mousescrolling.c3p

    If you're brand new to the engine, I definitely recommend familiarizing yourself with the beginner tutorial and concepts. While this isn't exactly a difficult mechanic, it does use a few behaviors working together, which may be confusing if you are not familiar with them.

  • Here is an example project - dropbox.com/s/34svcvglv9sr5kv/mousescrolling.c3p

    If you're brand new to the engine, I definitely recommend familiarizing yourself with the beginner tutorial and concepts. While this isn't exactly a difficult mechanic, it does use a few behaviors working together, which may be confusing if you are not familiar with them.

    hi and apologies for the delayed reply, was traveling.

    thanks so much for the sample, i had a look at it....and although it does work on the "basic principals",

    it will not work when the mouse is just going at the edge of the screen! what all rts users are doing actually. you have to have the mouse over the borders, but when you are moving a bit more to the edges it will stop or if you move your cursor tooo fast even in full screen it will not trigger the evens always.

    by extending the border width i think it working much better all sides BUT not the buttom. in the buttom my cursor gets out of the scree (no double monitors or anything) and the scrolling never happens.... any tips on that? :)

    thanks again a lot

  • It works fine for me fullscreen, extending the object past the viewport size could help.

    Alternatively, you can use the system compare two values condition, to compare the absolute position of the mouse and relevant viewport edge.

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