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

Discussion and feedback on Construct 2

Post » Sat Feb 25, 2012 6:45 pm

[QUOTE=TL22] 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).[/QUOTE]

@TL22 sorry, but i don't get it, could you explain me this.Thanks.
B
33
S
11
G
9
Posts: 381
Reputation: 10,153

Post » Sat Feb 25, 2012 11:59 pm

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.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Sun Feb 26, 2012 2:24 pm

[QUOTE=TL22] 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.[/QUOTE]

Ok thanks a lot!
B
33
S
11
G
9
Posts: 381
Reputation: 10,153

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: 99Instances2Go, caad8user, Zebbi and 3 guests