Help with frame panning

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I have this code here that is supposed to pan when you hold the middle mouse, the same as it would in the actual frame editor. Currently it doesn't work properly and drifts even when the mouse has stopped, and while I know why it's happening I'm not that experienced with clickteam so I don't know how to fix it. (1: The code currently used in clickteam, 2: What it currently does in clickteam, 3: How I would like it to work)

    (1)

    Please login to see this attachment.

    (2)

    Please login to see this link.

    (3)

    Please login to see this link.

  • Hi, I think you should not "add" the value to screenX, but set the screenx value instead, something like this:
    screenx = mouse_startX - MouseX
    screeny = mouse_startY - MouseY

    However, you should consider that you can move the mouse to the left direction, or the right direction, and as well with the Y position, up and down. That said, you should perhaps do a bit of calculation in order to position the background screen accordingly.

    For example, if the mouse is now on the right side respect to the initial position, that is, mouse_startX, then you should "scroll" the background screen to the left: set screenx = mouseStartX - ABS( mouseX - mouseStartX). (ABS = absolute value, non negative)
    But if the mouse is on the left side of mouse_StartX, you may set the screenx = mouse_StartX + ABS( mouseX - mouseStartX).

    Similar with the mouse up and down movement.

    Experiment with that, you will for sure find the way to scroll the background screen as you like. Post your results if you like ;)

    P.S.
    Bare in mind that it is not guaranteed that a mouse pointer with a middle button will be used. You should consider an alternative for that, or just use the right mouse button instead, which is always available.

  • When you said to use the "set" value instead of " add" it made me realise that if I save the screens position at the start of the movement, change it to " set" and add it to the start of the equation it works, thank you! :]Please login to see this attachment.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!