This issues caused by this.shape.transform( )
method returning Polygon but you are converting Ellipse.
Ellipse
and Polygon
are extended from the Shape
. So declare like Shape shape
instead of Ellipse shape
.
Now you can assign directly without casting.
this.shape = this.shape.transform(Transform.createTranslateTransform((float)(speed*Math.sin(angle)),(float)(speed*Math.cos(angle)*-1)));
if needed then you can type cast it.