Problem with set position to Mouse.X Mouse.Y

0 favourites
  • 3 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I'm trying to do a thing where I can pick up an object and drag it somewhere else and the code I'm using is basically start with a variable on -1, set it to 1 when I click, set it to 0 when I release, and setting it to 0 does some fancy stuff then automatically sets it back to -1. I've made it so that when the variable = 1 the object sets its position to Mouse.X Mouse.Y. All of this is working, but something really weird is happening with the last bit. When I click on it, instead of setting its position to my where my cursor is it sets it a set distance to the right, but even weirder, if I move my main character left (all this stuff is part of a pause menu) so that the main character's X value gets closer to 0, the change is less significant. If my main character's X value is 0 there is no problem.

    So is there anything I should check my code for that might be causing this issue? Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is caused by parallaxing. When you drag an object on an layer with parallaxing 0,0 you have to use Mouse.AbsoluteX or Mouse.X("MenuLayerName"). Same for Mouse.Y.

  • This is caused by parallaxing. When you drag an object on an layer with parallaxing 0,0 you have to use Mouse.AbsoluteX or Mouse.X("MenuLayerName"). Same for Mouse.Y.

    Setting its position to Mouse.X("MenuLayerName") worked perfectly. Thanks!

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