Skip to content

Commit 5fd66eb

Browse files
authored
him which is, and which was, and which is to come
John to the seven churches which are in Asia: Grace [be] unto you, and peace, from him which is, and which was, and which is to come; and from the seven Spirits which are before his throne (Revelation 1:4)
1 parent 2cdfece commit 5fd66eb

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
2+
//John to the seven churches which are in Asia: Grace [be] unto you, and peace, from him which is, and which was,
3+
//and which is to come; and from the seven Spirits which are before his throne (Revelation 1:4)
4+
5+
package com.javarush.task.task25.task2515;
6+
7+
public class Bomb extends BaseObject {
8+
9+
public Bomb(double x, double y) {
10+
super(x, y, 1);
11+
}
12+
13+
public void move() {y++;}
14+
15+
public void draw(Canvas canvas) {
16+
canvas.setPoint(x,y,'B');
17+
}
18+
}
19+
20+
/*
21+
Space (10)
22+
23+
Теперь напишем класс Bomb. Тут все просто.
24+
25+
Bomb унаследован от BaseObject.
26+
27+
28+
29+
Надо:
30+
31+
а) изменить конструктор:
32+
33+
Конструктор Bomb должен выглядеть примерно так:
34+
35+
public Bomb(double x, double y)
36+
37+
{
38+
39+
super(x, y, 1);
40+
41+
}
42+
43+
44+
45+
x и y переданные в конструктор Bomb мы передаем дальше в конструктор BaseObject с помощью super, где так же указываем радиус "бомбы" равный 1.
46+
47+
48+
49+
б) написать метод move():
50+
51+
тут все просто - бомба падает вниз - просто увеличиваем y на 1.
52+
53+
54+
55+
в) метод draw(Canvas canvas):
56+
57+
тут тоже не очень сложная логика.
58+
59+
Давай просто ставить точку с координатами (x,y) и "цветом" B:
60+
61+
canvas.setPoint(x,y,'B').
62+
63+
64+
65+
г) Создай в классе Space нашу игру public static Space game.
66+
67+
68+
69+
70+
71+
Требования:
72+
73+
1. В классе Bomb конструктор должен принимать координаты, а радиус выставлять всегда равным 1.
74+
75+
2. В классе Bomb напиши метод move(), который увеличивает координату y на единицу.
76+
77+
3. В классе Bomb напиши метод draw(Canvas canvas), который для canvas будет ставить символ 'B' в координатах x, y.
78+
79+
4. В классе Space создай поле public static Space game.
80+
*/

0 commit comments

Comments
 (0)