Cannot access it from Ball ?
Do I need to create a new Canvas object each time in the Ball.draw() method ?
Then call the newly created canvas object's setPoint() ?
Makes no sense ?
Second question: The original creation requirement for Ball, had another constructor.
Had to modify it now with this task's requirements, but what happens to the local variables ?
I mean, I assume (because I'm not certain) that I still have to pass variables to the superclass (BaseObject), so what do i do with my local dx and dy variables ?
Also increase them ?
Currently, this is my constructor:
public Ball(double x, double y, double speed, double direction) {
super(x, y, 1);
this.speed = speed;
this.direction = direction;
this.dx = x;
this.dy = y;
isFrozen = true;
}
package com.codegym.task.task24.task2413;
import java.util.List;
public class Arkanoid {
private int width;
private int height;
private Ball ball;
private Paddle paddle;
private List<Brick> bricks;
public static Arkanoid game;
public Arkanoid(int width, int height) {
this.width = width;
this.height = height;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public void setWidth(int width) {
this.width = width;
}
public void setHeight(int height) {
this.height = height;
}
public Ball getBall() {
return ball;
}
public Paddle getPaddle() {
return paddle;
}
public List<Brick> getBricks() {
return bricks;
}
public void setBall(Ball ball) {
this.ball = ball;
}
public void setPaddle(Paddle paddle) {
this.paddle = paddle;
}
public void setBricks(List<Brick> bricks) {
this.bricks = bricks;
}
public void run(){
}
public void move(){
}
public static void main(String[] args){
}
}