FiXED How do I fix mouse with rotating camera?

0 favourites
  • 8 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I get to a problem while the Player is running around the planet, the mouse pointer doesn't actually follow the mouse, it stays on the layout, where the "virtual" mouse is. (or I think)

    I can't figure out how to fix it :/

    In the .capx file I disabled the "following camera" so you'll get the feel how it should work...

    I also simplified it so you don't get lost

    capx here

    1drv.ms/1Voddlv

    Btw, I also wounder (but it's not really that important), if I set the planet to rotate at a certain speed, how do I fix the player to rotate with the planet?

    Made also a much simpler version where the player stays at place and you rotate the planet, but it's not that fun (to make)...

  • I'm on my phone but would using mouse.x(layer) help? That should give a the mouse position on a layer. If you just use mouse.x it just uses the first layer which is the hud usually.

  • I'll give it a try, thanks a lot for the reply!

  • Sorry, but can you be more specific of how to do that? If I just add an extension mouse.x(layer) or (layer name) it hits me with a "Unknown expresion" message

    Edit: I added "layer", and it recognizes it, but still does the same, as with absolute.X

  • From the manual:

    Mouse expressions

    AbsoluteX

    AbsoluteY

    Return the position of the mouse cursor over the canvas area in the HTML page. This is (0, 0) at the top left of the canvas and goes up to the window size. It is not affected by any scrolling or scaling in the game.

    X

    Y

    Return the position of the mouse cursor in game co-ordinates. This is (0, 0) at the top left of the layout. It changes to reflect scrolling and scaling. However, if an individual layer has been scrolled, scaled or rotated, these expressions do not take that in to account - for that case, use the layer versions below.

    X("layer")

    Y("layer")

    Return the position of the mouse cursor in game co-ordinates, with scrolling, scaling and rotation taken in to account for the given layer. The layer can be identified either by a string of its name or its zero-based index (e.g. Mouse.X(0)).

    so:

    mouse.x(0) - would be the x-position of the mouse on layer 0

    mouse.x("HUD") - would be the x-position of the mouse on layer with the name HUD

  • Wait, how do I then fix the "HUD" to not rotate with the layer 0?

    Edit: I added the HUD layer, and set the parallax to 0, 0... but it seems to be even worse :/

    Haven't worked on the HUD yet, so sorry for the dummines...

    And thank you a lot!

  • This is how it works:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It really does!

    Thank you a lot!!

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