0 Favourites

keyboard scrolling

This forum is currently in read-only mode.
  • heya. i recently was sorta making an attempt to make a game but I've already hit a roadblock (lol)

    I've got mouse scrolling working with tutorials found in the forum, but I can't seem to be able to get the keyboard scrolling to work - like in RTS where you can press arrow keys to move your screen around.

    I've currently set 'the key - is down' and it is instructed to perform 'system: scroll to x 10', but instead of scrolling incrementally, it just warps to x10 coordinates. how can I set the math to work incrementally?

    also, another question if you don't mind. is it possible to attach RTS behavior sprites to other sprites so their movements are constricted? like a road, for example. (instead of going through pesky pathfinding.)

    thanks!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You need to retrieve the current scroll value. So instead of scroll to X 10, it should be scroll to X ScrollX + 10. ScrollX will retrieve the current X scroll value; likewise, ScrollY will retrieve the current Y scroll value.

    Also, I don't there's a way to do anything like the second question you asked(not in the behavior, anyways). You'd have to come up with your own method of doing that.

  • woot! thanks. that solved my scrolling problem. I'll try to think of something for my second question... perhaps i am to wait for path implementation.

  • Use Time Delta for smooth scrolling!

    +Key Right is down

    Scroll.X=Scroll.X+20*TimeDelta (use a higher multiplier for faster scrolling)

  • Use Time Delta for smooth scrolling!

    +Key Right is down

    > Scroll.X=Scroll.X+20*TimeDelta (use a higher multiplier for faster scrolling)

    awesome, thanks!

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