Skip to content

Commit

Permalink
Move the project from sourceforge to GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
devng committed Aug 3, 2015
1 parent 88b8191 commit d2d6889
Show file tree
Hide file tree
Showing 17 changed files with 1,951 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
2015-08-03
----------
* Move the project from sourceforge.net to GitHub
* Change the licence from MPL 1.1 to MPL 2.0
* Change documentation format from TXT to MD

2006-09-28
----------
* JETRIS version 1.1
* Help dialog in the help menu added
* Splash screen added
* Faster HiScore publishing
* HiScore are now painted red, so a player wont get confused
* Fixed bug when pressing the cancel button on 'Enter your name' dialog
* A pause bug was fixed

2006-09-26
----------
* Initial release, JETRIS version 1.0
3 changes: 3 additions & 0 deletions JETRIS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

java -jar JETRIS.jar
3 changes: 3 additions & 0 deletions JETRIS.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rem Batch file to run JETRIS on Windows

start javaw -jar JETRIS.jar
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Jetris 1.1 - A Java-Based Tetris Clone

### This Readme includes:

1. System requirements
2. Running JETRIS on your system
3. How to play
4. Scoring System
6. Saving your old HiScores after version update

1. System requirements
----------------------

Jetris is written in JAVA programming language, this means that it can be run on any Operating System which has JAVA Runtime Environment (JRE).

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.

You can download JRE for free at www.java.com

2. Running JETRIS on your system
--------------------------------

To start JETRIS try one of the following options:

* 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.

* Double click on JETRIS.bat for Windows users or on JETRIS for Linux users.

* Open the console go to your JETRIS folder and type:

java -jar JETRIS.jar

### For example:
You have a Windows Operating System, your JETRIS folder is C:\JETRIS then:

Open Start Menu -> Run type "cmd" in the console type "cd C:\JETRIS" hit Enter then type "java -jar JETRIS.jar" hit Enter

3. How to play
--------------

Use the following keys to play JETRIS:

* A or Left Arrow - Move the figure to left
* D or Right Arrow - Move the figure to right
* W or Up Arrow - Rotate the figure
* S or Down Arrow - Move the figure quick down
* Space - Drop the figure immediately
* P or 'Pause' Button - Pause
* R or 'Restart' Button - Restart
* H - View HiScore
* Esc - Exit

4. Scoring System
-----------------

* Clearing 1 Line at once, gives You 100 points + 5 x the current level
* Clearing 2 Line at once, gives You 400 points + 20 x the current level
* Clearing 3 Line at once, gives You 900 points + 45 x the current level
* Clearing 4 Line at once, gives You 1600 points + 80 x the current level

### For example:

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.

5. Saving your old HiScores after version update
------------------------------------------------

Copy the old JETRIS.dat File to your new version of Jetris folder.


Binary file added jetris.ico
Binary file not shown.
9 changes: 9 additions & 0 deletions src/JetrisMain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import net.sourceforge.jetris.JetrisMainFrame;

public class JetrisMain {
public static void main(String[] args) {
JetrisMainFrame mf = new JetrisMainFrame();

}

}
64 changes: 64 additions & 0 deletions src/net/sourceforge/jetris/Figure.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package net.sourceforge.jetris;
import java.awt.Color;

public abstract class Figure {

protected final static int I = 1;
protected final static int T = 2;
protected final static int O = 3;
protected final static int L = 4;
protected final static int J = 5;
protected final static int S = 6;
protected final static int Z = 7;

protected final static Color COL_I = Color.RED;
protected final static Color COL_T = Color.GRAY;
protected final static Color COL_O = Color.CYAN;
protected final static Color COL_L = Color.ORANGE;
protected final static Color COL_J = Color.MAGENTA;
protected final static Color COL_S = Color.BLUE;
protected final static Color COL_Z = Color.GREEN;

protected int[] arrX;
protected int[] arrY;

protected int offsetX;
protected int offsetY;

protected int offsetXLast;
protected int offsetYLast;

protected Figure(int[] arrX, int[]arrY) {
this.arrX = arrX;
this.arrY = arrY;
offsetYLast = offsetY = 0;
offsetXLast = offsetX = 4;
}

protected int getMaxRightOffset() {
int r = Integer.MIN_VALUE;
for (int i = 0; i < arrX.length; i++) {
if(r < arrX[i]) r = arrX[i];
}
return r+offsetX;
}

protected void setOffset(int x, int y) {
offsetXLast = offsetX;
offsetYLast = offsetY;
offsetX = x;
offsetY = y;
}

protected void resetOffsets() {
offsetX = offsetY = offsetXLast = offsetYLast = 0;
}

protected abstract void rotationRight();

protected abstract void rotationLeft();

protected abstract int getGridVal();

protected abstract Color getGolor();
}
55 changes: 55 additions & 0 deletions src/net/sourceforge/jetris/FigureFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package net.sourceforge.jetris;
import java.util.Random;

/* FigureFactory created on 14.09.2006 */

public class FigureFactory {

Random r;
private int[] counts;
private int lastLastOne;
private int lastOne;

FigureFactory() {
r = new Random();
counts = new int[7];
}

Figure getRandomFigure() {
Figure f;
int i = r.nextInt(7);
while(lastLastOne == lastOne && lastOne == i+1) {
i = r.nextInt(7);
}
switch (i) {
case 0: f = new FigureI(); break;
case 1: f = new FigureT(); break;
case 2: f = new FigureO(); break;
case 3: f = new FigureL(); break;
case 4: f = new FigureJ(); break;
case 5: f = new FigureS(); break;
default: f = new FigureZ(); break;
}
lastLastOne = lastOne;
lastOne = i+1;
counts[i]++;

i = r.nextInt(4);

for (int j = 0; j < i; j++) {
f.rotationRight();
}

return f;
}

protected int[] getCounts() {
return counts;
}

protected void resetCounts() {
for (int i = 0; i < counts.length; i++) {
counts[i] = 0;
}
}
}
Loading

0 comments on commit d2d6889

Please sign in to comment.