Skip to content

Commit d2d6889

Browse files
committed
Move the project from sourceforge to GitHub
1 parent 88b8191 commit d2d6889

17 files changed

+1951
-0
lines changed

CHANGES.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2015-08-03
2+
----------
3+
* Move the project from sourceforge.net to GitHub
4+
* Change the licence from MPL 1.1 to MPL 2.0
5+
* Change documentation format from TXT to MD
6+
7+
2006-09-28
8+
----------
9+
* JETRIS version 1.1
10+
* Help dialog in the help menu added
11+
* Splash screen added
12+
* Faster HiScore publishing
13+
* HiScore are now painted red, so a player wont get confused
14+
* Fixed bug when pressing the cancel button on 'Enter your name' dialog
15+
* A pause bug was fixed
16+
17+
2006-09-26
18+
----------
19+
* Initial release, JETRIS version 1.0

JETRIS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
java -jar JETRIS.jar

JETRIS.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rem Batch file to run JETRIS on Windows
2+
3+
start javaw -jar JETRIS.jar

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Jetris 1.1 - A Java-Based Tetris Clone
2+
3+
### This Readme includes:
4+
5+
1. System requirements
6+
2. Running JETRIS on your system
7+
3. How to play
8+
4. Scoring System
9+
6. Saving your old HiScores after version update
10+
11+
1. System requirements
12+
----------------------
13+
14+
Jetris is written in JAVA programming language, this means that it can be run on any Operating System which has JAVA Runtime Environment (JRE).
15+
16+
You need JRE 1.5.0 (also know as JRE 5) or above. If you have an older JRE version then you will get an error message and the program will exit.
17+
18+
You can download JRE for free at www.java.com
19+
20+
2. Running JETRIS on your system
21+
--------------------------------
22+
23+
To start JETRIS try one of the following options:
24+
25+
* Double click on the JAR File to start JETRIS. If this didn't work, then you didn't associate your JAR Files with your JRE.
26+
27+
* Double click on JETRIS.bat for Windows users or on JETRIS for Linux users.
28+
29+
* Open the console go to your JETRIS folder and type:
30+
31+
java -jar JETRIS.jar
32+
33+
### For example:
34+
You have a Windows Operating System, your JETRIS folder is C:\JETRIS then:
35+
36+
Open Start Menu -> Run type "cmd" in the console type "cd C:\JETRIS" hit Enter then type "java -jar JETRIS.jar" hit Enter
37+
38+
3. How to play
39+
--------------
40+
41+
Use the following keys to play JETRIS:
42+
43+
* A or Left Arrow - Move the figure to left
44+
* D or Right Arrow - Move the figure to right
45+
* W or Up Arrow - Rotate the figure
46+
* S or Down Arrow - Move the figure quick down
47+
* Space - Drop the figure immediately
48+
* P or 'Pause' Button - Pause
49+
* R or 'Restart' Button - Restart
50+
* H - View HiScore
51+
* Esc - Exit
52+
53+
4. Scoring System
54+
-----------------
55+
56+
* Clearing 1 Line at once, gives You 100 points + 5 x the current level
57+
* Clearing 2 Line at once, gives You 400 points + 20 x the current level
58+
* Clearing 3 Line at once, gives You 900 points + 45 x the current level
59+
* Clearing 4 Line at once, gives You 1600 points + 80 x the current level
60+
61+
### For example:
62+
63+
The current level is 20 (the highest level) and You clear 4 Lines at once, then You get 1600 + 80 x 20 = 2 x 1600 = 3200. So on level 20 you are making twice as much points as on level 0.
64+
65+
5. Saving your old HiScores after version update
66+
------------------------------------------------
67+
68+
Copy the old JETRIS.dat File to your new version of Jetris folder.
69+
70+

jetris.ico

3.19 KB
Binary file not shown.

src/JetrisMain.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import net.sourceforge.jetris.JetrisMainFrame;
2+
3+
public class JetrisMain {
4+
public static void main(String[] args) {
5+
JetrisMainFrame mf = new JetrisMainFrame();
6+
7+
}
8+
9+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package net.sourceforge.jetris;
2+
import java.awt.Color;
3+
4+
public abstract class Figure {
5+
6+
protected final static int I = 1;
7+
protected final static int T = 2;
8+
protected final static int O = 3;
9+
protected final static int L = 4;
10+
protected final static int J = 5;
11+
protected final static int S = 6;
12+
protected final static int Z = 7;
13+
14+
protected final static Color COL_I = Color.RED;
15+
protected final static Color COL_T = Color.GRAY;
16+
protected final static Color COL_O = Color.CYAN;
17+
protected final static Color COL_L = Color.ORANGE;
18+
protected final static Color COL_J = Color.MAGENTA;
19+
protected final static Color COL_S = Color.BLUE;
20+
protected final static Color COL_Z = Color.GREEN;
21+
22+
protected int[] arrX;
23+
protected int[] arrY;
24+
25+
protected int offsetX;
26+
protected int offsetY;
27+
28+
protected int offsetXLast;
29+
protected int offsetYLast;
30+
31+
protected Figure(int[] arrX, int[]arrY) {
32+
this.arrX = arrX;
33+
this.arrY = arrY;
34+
offsetYLast = offsetY = 0;
35+
offsetXLast = offsetX = 4;
36+
}
37+
38+
protected int getMaxRightOffset() {
39+
int r = Integer.MIN_VALUE;
40+
for (int i = 0; i < arrX.length; i++) {
41+
if(r < arrX[i]) r = arrX[i];
42+
}
43+
return r+offsetX;
44+
}
45+
46+
protected void setOffset(int x, int y) {
47+
offsetXLast = offsetX;
48+
offsetYLast = offsetY;
49+
offsetX = x;
50+
offsetY = y;
51+
}
52+
53+
protected void resetOffsets() {
54+
offsetX = offsetY = offsetXLast = offsetYLast = 0;
55+
}
56+
57+
protected abstract void rotationRight();
58+
59+
protected abstract void rotationLeft();
60+
61+
protected abstract int getGridVal();
62+
63+
protected abstract Color getGolor();
64+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package net.sourceforge.jetris;
2+
import java.util.Random;
3+
4+
/* FigureFactory created on 14.09.2006 */
5+
6+
public class FigureFactory {
7+
8+
Random r;
9+
private int[] counts;
10+
private int lastLastOne;
11+
private int lastOne;
12+
13+
FigureFactory() {
14+
r = new Random();
15+
counts = new int[7];
16+
}
17+
18+
Figure getRandomFigure() {
19+
Figure f;
20+
int i = r.nextInt(7);
21+
while(lastLastOne == lastOne && lastOne == i+1) {
22+
i = r.nextInt(7);
23+
}
24+
switch (i) {
25+
case 0: f = new FigureI(); break;
26+
case 1: f = new FigureT(); break;
27+
case 2: f = new FigureO(); break;
28+
case 3: f = new FigureL(); break;
29+
case 4: f = new FigureJ(); break;
30+
case 5: f = new FigureS(); break;
31+
default: f = new FigureZ(); break;
32+
}
33+
lastLastOne = lastOne;
34+
lastOne = i+1;
35+
counts[i]++;
36+
37+
i = r.nextInt(4);
38+
39+
for (int j = 0; j < i; j++) {
40+
f.rotationRight();
41+
}
42+
43+
return f;
44+
}
45+
46+
protected int[] getCounts() {
47+
return counts;
48+
}
49+
50+
protected void resetCounts() {
51+
for (int i = 0; i < counts.length; i++) {
52+
counts[i] = 0;
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)