Skip to content

Commit fe35d33

Browse files
committed
first commit
1 parent a03807d commit fe35d33

File tree

13 files changed

+455
-0
lines changed

13 files changed

+455
-0
lines changed

Worm/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

Worm/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Worm</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#Sat Nov 23 09:57:32 CST 2013
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6+
org.eclipse.jdt.core.compiler.compliance=1.6
7+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.source=1.6

Worm/bin/worm/Cell.class

746 Bytes
Binary file not shown.

Worm/bin/worm/Worm.class

2.45 KB
Binary file not shown.

Worm/bin/worm/WormFrame.class

1.38 KB
Binary file not shown.
1.53 KB
Binary file not shown.

Worm/bin/worm/WormStage$Move.class

1.6 KB
Binary file not shown.

Worm/bin/worm/WormStage.class

2.83 KB
Binary file not shown.

Worm/src/worm/Cell.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package worm;
2+
3+
import java.awt.*;
4+
5+
/**
6+
* 网格类
7+
* @author Leslie Leung
8+
*/
9+
public class Cell {
10+
11+
public static final int CELL_SIZE = 10; //设置每个格子的大小,大小为10像素
12+
13+
/* 定义格子坐标 */
14+
private int x;
15+
private int y;
16+
17+
/**
18+
* 构造方法,设置网格的坐标
19+
* @param x 横坐标
20+
* @param y 纵坐标
21+
*/
22+
public Cell(int x, int y) {
23+
this.x = x;
24+
this.y = y;
25+
}
26+
27+
/**
28+
* 获取网格的横坐标
29+
* @return 网格的横坐标
30+
*/
31+
public int getX() {
32+
return x;
33+
}
34+
35+
/**
36+
* 获取网格的纵坐标
37+
* @return 网格的纵坐标
38+
*/
39+
public int getY() {
40+
return y;
41+
}
42+
43+
public void paintCell(Graphics g) {
44+
g.fillRect(x * CELL_SIZE, y * CELL_SIZE, CELL_SIZE, CELL_SIZE);
45+
}
46+
}

0 commit comments

Comments
 (0)