Unbounded mouse

0 favourites
  • 7 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hi everyone.

    I'm trying to implement a view where the entire layer rotates around the player when I move the mouse (think of it as a top-down first person shooter). I'm running into problems whenever I've rotated too much to one side and the mouse hits the border of the viewport. Whenever that happens, I can't keep rotating to that side because the engine doesn't register the mouse X position to be any greater. Is there some way of removing the boundaries on the cursor or resetting its position when it reaches the border?

    This is how I'm rotating the layer, and it works (even movement works)

    As you see, at some point Mouse.X will reach the end of the layout (or viewport if I use AbsoluteX) and then I simply can't keep rotating in that direction. I'm wondering how other engines handle this sort of camera scheme, since first person shooters let you spin all you want in the same direction.

    Cheers

  • I'm not sure what is the behavior you're trying to achieve here. Have a capx?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Does the distance to the mouse cursor matter, or just the angle? If it's just the angle, it shouldn't matter should it? The angle to the mouse will still be the same, if it just moves around the edges of the screen?

  • Here's a capx of the rotation only.

    If you move the mouse around you'll see that the layer rotates but the player doesn't. My intent is to later only move the player in the direction he's facing (like a first person shooter). The problem is that when the mouse reaches the limit of the screen, rotation stops. I want to allow the player to rotate the layer indefinitely in the same direction and don't know how to accomplish that.

  • If I could somehow override the cursor position manually I could make it appear at the opposite edge of the window whenever it goes out of bounds, fixing the problem. Bur afaik there's no way to do that in Construct 2

  • Ah yes, the problem as you say is that when the mouse leaves the window, it's no longer tracked at all in C2 (if you track Mouse.X and Mouse.Y for example, they just 'stick' if you leave the window). There might be a solution to this, but I'd consider a different control method as it's too confusing. Or at least have the mouse cursor really prominent so it's very clear to the player that it's being used as the focal point. All I can think of, sorry.

  • monitz87 You can try a different movement method, like farflamex suggested. Try out my modified version html

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