@Override public void draw(Screen screen, int ref, Point centerGrav) { Point vf_s_jos = centerGrav.translate(-2 * ref, -ref); Point vf_d_jos = centerGrav.translate(2 * ref, -ref); Point vf_s_sus = centerGrav.translate(-2 * ref, ref); Point vf_d_sus = centerGrav.translate(2 * ref, ref); screen.drawLineOnScreen(vf_s_jos, vf_s_sus, Symbols.RECTANGLE_SYMBOL); screen.drawLineOnScreen(vf_s_sus, vf_d_sus, Symbols.RECTANGLE_SYMBOL); screen.drawLineOnScreen(vf_d_sus, vf_d_jos, Symbols.RECTANGLE_SYMBOL); screen.drawLineOnScreen(vf_d_jos, vf_s_jos, Symbols.RECTANGLE_SYMBOL); }
@Override public void shoot(int dist, Point shooterPosition) { shapeChangingDist = calculateShapeChangingDist(7); if (dist < shapeChangingDist) { shooterPosition = shooterPosition.translate( (int) (Math.round(Math.sin(dist * Math.PI / 2))), (int) (Math.round(Math.cos(dist * Math.PI / 2)))); this.ref = calculateNewRef(dist, 7); this.hitScreenActionSpiderShot(shooterPosition, this.ref); } // The projectile changes type. else { dist = dist - shapeChangingDist; shooterPosition = shooterPosition.translate( (int) (Math.round(Math.sin(shapeChangingDist * Math.PI / 2))), (int) (Math.round(Math.cos(shapeChangingDist * Math.PI / 2)))); this.ref = calculateNewRef(shapeChangingDist, 7); super.shoot(dist, shooterPosition); } }