Possible loss of precision / [type] cannot be dereferenced
- by Samuel
I have been looking around a lot but i simply can't find a nice solution to this...
Point mouse = MouseInfo.getPointerInfo().getLocation();
int dx = (BULLET_SPEED*Math.abs(x - mouse.getX()))/
(Math.abs(y - mouse.getY()) + Math.abs(x - mouse.getX()))*
(x - mouse.getX())/Math.abs(x - mouse.getX());
In this constellation i get: Possible loss of precision, when i change e.g (x - mouse.getX()) to (x - mouse.getX()).doubleValue() it says double cannot be dereferenced, when i add intValue() somewhere it says int cannot be dereferenced. What's my mistake?
[x, y are integers | BULLET_SPEED is a static final int]
Thanks!