[java] jupp, even another problem! :D

Started by
2 comments, last by sushi-one 20 years, 2 months ago
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
Hans-Petter Harveg
Advertisement
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?
The ability to succeed is the ability to adapt
im just getting the coordinates from the mouse so I can move my sprite..

HP
Hans-Petter Harveg
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
Hans-Petter Harveg

This topic is closed to new replies.

Advertisement