Set position to(Mouse.X,Mouse.Y)Chrome performance

0 favourites
  • 12 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Hi here's a capx with a simple event:

    everytick-apple-set position to (Mouse.X, Mouse.Y)

    In Firefox and IE it runs smoothly but in Chrome there is a little lag in the update of the position of the apple.I'm making a game and the controls are based on this.Can someone please check if this happens in your setup.Thanks.

    setposition

    capx

  • It was lagging on my computer too..using chrome...seems like it should stay at the mouse.x and mouse.y position but it fell away from it more like it was following the mouse instead of snapping to it..if that makes sense.

  • Thanks,i'm using R74(wainting for a a more stable version) but if this happens with the capx file aswell, it has to be a chrome problem.Any suggestions?

  • It almost looks like it's setting the position the next tick...

  • Thanks,i'm using R74(wainting for a a more stable version

    : the very latest version (r79.4) is the latest stable version.

    You really should update to it.

  • Kyatric ok i'll try the latest version but i'm seeing a lot of bugs reported in the forum.tks

  • Some browsers use techniques like double-buffering that make the game run faster - but this imposes a one-frame delay, so things like this are always one frame behind. It's typical of practically any game engine as well.

    You should not try and use sprites to replace the mouse cursor because of this problem. It can make input really laggy and frustrating. If you're just dragging around other objects, the delay shouldn't be a problem.

  • Thanks Ashley, i was only asking because it runs perfectly in firefox and IE.I'm not using this to replace mouse cursor, is more like to drag but i need a lot of accuracy to point to the wanted spot.I'll do this in a different way.Tks.

  • My game uses a sprite for a mouse cursor. What I do is I don't check for Mouse.X or Mouse.Y, but rather the mouse cursor sprite's X and Y. That way you don't get the appearance of that delay in positioning. It's still there obviously, but it doesn't matter. Works great for my game (which is a point and click adventure by the way).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My game uses a sprite for a mouse cursor. What I do is I don't check for Mouse.X or Mouse.Y, but rather the mouse cursor sprite's X and Y. That way you don't get the appearance of that delay in positioning. It's still there obviously, but it doesn't matter. Works great for my game (which is a point and click adventure by the way).

    sorry, but i don't get it, could you explain me this.Thanks.

  • Let's say you had a sprite called CursorSprite that you wanted to use as your mouse cursor. You set CursorSprite's position to Mouse.X and Mouse.Y every tick and hide the default mouse cursor by setting the Mouse's cursor type to "none".

    Then you only test for the CursorSprite's position. Instead of doing "is mouse over object?" you do "is CursorSprite overlapping object?" And instead of comparing "Mouse.X" or "Mouse.Y", you compare "CursorSprite.X" and "CursorSprite.Y". The only mouse conditions you would really end up needing are the "On button clicked/button down" conditions.

    That's how I do it anyway.

  • Let's say you had a sprite called CursorSprite that you wanted to use as your mouse cursor. You set CursorSprite's position to Mouse.X and Mouse.Y every tick and hide the default mouse cursor by setting the Mouse's cursor type to "none".

    Then you only test for the CursorSprite's position. Instead of doing "is mouse over object?" you do "is CursorSprite overlapping object?" And instead of comparing "Mouse.X" or "Mouse.Y", you compare "CursorSprite.X" and "CursorSprite.Y". The only mouse conditions you would really end up needing are the "On button clicked/button down" conditions.

    That's how I do it anyway.

    Ok thanks a lot!

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