-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevel2.java
More file actions
60 lines (47 loc) · 1.28 KB
/
Level2.java
File metadata and controls
60 lines (47 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//Level2 for snake game
import java.util.*;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.util.LinkedList;
public class Level2 {
public static LinkedList list;
public Level2(){
init();
}
public void init(){
list = new LinkedList();
}
public void DrawWall(Graphics g){
g.setColor(Color.black);
Iterator itr=list.iterator();
while(itr.hasNext())
{
Point w=(Point)itr.next();
g.fillRect(w.x*snakeCals.BOX_WIDTH, w.y*snakeCals.BOX_HEIGHT, snakeCals.BOX_WIDTH, snakeCals.BOX_HEIGHT);
//itr=itr.next();
}
}
public void level2(){
//wall 1
list.add(new Point(3,4));
list.add(new Point(4,4));
list.add(new Point(5,4));
list.add(new Point(6,4));
list.add(new Point(7,4));
list.add(new Point(8,4));
list.add(new Point(9,4));
list.add(new Point(10,4));
list.add(new Point(11,4));
//wall 2
list.add(new Point(3,12));
list.add(new Point(4,12));
list.add(new Point(5,12));
list.add(new Point(6,12));
list.add(new Point(7,12));
list.add(new Point(8,12));
list.add(new Point(9,12));
list.add(new Point(10,12));
list.add(new Point(11,12));
}
}