Archived

This topic is now archived and is closed to further replies.

sushi-one

[java] jupp, even another problem! :D

Recommended Posts

well, this time, I have some problems with the mouse motion listener, my game is *really* slowing down when I move the mouse, it''s strange, because it does not slow down when I press the mouse button or when I control the game by using the keyboard is there any method I forget to use or something? (like to syncronice all the three events or something) becouse all I do now is addlistener and removelistener.. Hans-Petter

Share this post


Link to post
Share on other sites
I''m not sure if you have connected an object to the movement of the mouse, eg. like a space jet or something but the only reason I can think of (not seing your code) is that the program is trying to repaint at the speed that the mouse is moving. You can move the mouse to a specific point much faster that you can get there by pressing the keys.

What are you trying to do?

Share this post


Link to post
Share on other sites
I got it to work now, but it''s strange, it works fine when I save the position in a static variable, and then copy this value to my class:

void mousemove()
xpos = event.x;
}

and then in the game loop:
sprite.xpos = xpos;

-----

why does it slow down when I save the value directly to the class:

void mousemove()
sprite.xpos = event.xpos;
}

---------------


Hans-Petter

Share this post


Link to post
Share on other sites