I’ve been trying to get an Entity to follow the mouse position exactly but everything I’ve tried so far shows a visible lag.
I’m currently trying in a fairly bare bones test environment and the movement code is the World’s update override.
This doesn’t actually matter much for my current project as I will be hiding the mouse cursor, but I’d still like to know if there is a way to achieve this.
I noticed the same thing. I don’t think there’s anything you can do if you’re using an entity as the cursor. The entity render code seems to be a tick or two behind the OS cursor render code. I don’t know if Flash has any custom cursor support that would work better.
I did some testing on my own and found that, after hiding the mouse cursor with Mouse.hide(), it’s impossible to tell the cursor in FlashPunk is lagging behind the actual mouse. The only time it feels like it’s lagging is when there’s a second mouse cursor.
My suggestion would be to just hide the system mouse cursor and assume nothing is amiss.
Yeah, my tests prove the same thing, but the reason I ask is that lets say that in another project I wouldn’t be messing with cursor, but would have Entity’s that I would need to drag and drop. This would indeed show the lag.
I guess the only way is to always hide and replace the mouse cursor, even if the the replaced cursor is replica of the default OS cursor, which may or may not be weird to users who have custom cursor situations.
Cursor replacement is the standard for almost every modern game. Think about any MMO with dragging and dropping items and you’ll see custom cursors.
I’ll admit, in an embedded Flash player, it does look weird going from system mouse to game cursor on a web page, but running it full screen, especially if any screen resizing is occurring, it would look weird to not replace the cursor.
I wouldn’t try to replicate the user’s default cursor at all. I’d make a cursor that belongs to your game. You’ve got custom buttons, typography and art, why wouldn’t you have a custom cursor? Then again, that’s my opinion.