Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
36 changes: 33 additions & 3 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="test">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/chana/.m2/repository/org/mockito/mockito-core/2.18.3/mockito-core-2.18.3.jar">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="maven.groupId" value="org.mockito"/>
<attribute name="maven.artifactId" value="mockito-core"/>
<attribute name="maven.version" value="2.18.3"/>
<attribute name="maven.scope" value="compile"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin/
/target/
6 changes: 6 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
5 changes: 5 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Tetris
This is a Tetris game that can be played on your computer by running the eclipse project. It is easy to play using simple keyboard controls that allow you to move pieces side to side, rotate pieces, drop pieces quickly to the bottom, and switch the current piece with the next one.
Binary file removed bin/org/psnbtech/BoardPanel.class
Binary file not shown.
Binary file removed bin/org/psnbtech/Clock.class
Binary file not shown.
Binary file removed bin/org/psnbtech/SidePanel.class
Binary file not shown.
Binary file removed bin/org/psnbtech/Tetris$1.class
Binary file not shown.
Binary file removed bin/org/psnbtech/Tetris.class
Binary file not shown.
Binary file removed bin/org/psnbtech/TileType.class
Binary file not shown.
29 changes: 29 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Tetris</groupId>
<artifactId>Tetris</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.18.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/org/.DS_Store
Binary file not shown.
Binary file added src/org/psnbtech/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion src/org/psnbtech/BoardPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public void paintComponent(Graphics g) {
* down until we hit a row that would cause a collision.
*/
Color base = type.getBaseColor();
base = new Color(base.getRed(), base.getGreen(), base.getBlue(), 20);
base = new Color(base.getRed(), base.getGreen(), base.getBlue(), 50);
for(int lowest = pieceRow; lowest < ROW_COUNT; lowest++) {
//If no collision is detected, try the next row.
if(isValidAndEmpty(type, pieceCol, lowest, rotation)) {
Expand Down
18 changes: 10 additions & 8 deletions src/org/psnbtech/SidePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public class SidePanel extends JPanel {
/**
* The y coordinate of the stats category.
*/
private static final int STATS_INSET = 175;
private static final int STATS_INSET = 155;

/**
* The y coordinate of the controls category.
*/
private static final int CONTROLS_INSET = 300;
private static final int CONTROLS_INSET = 260;

/**
* The number of pixels to offset between each string.
Expand Down Expand Up @@ -103,7 +103,7 @@ public class SidePanel extends JPanel {
public SidePanel(Tetris tetris) {
this.tetris = tetris;

setPreferredSize(new Dimension(200, BoardPanel.PANEL_HEIGHT));
setPreferredSize(new Dimension(250, BoardPanel.PANEL_HEIGHT));
setBackground(Color.BLACK);
}

Expand Down Expand Up @@ -136,11 +136,13 @@ public void paintComponent(Graphics g) {
g.setFont(LARGE_FONT);
g.drawString("Controls", SMALL_INSET, offset = CONTROLS_INSET);
g.setFont(SMALL_FONT);
g.drawString("A - Move Left", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("D - Move Right", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("Q - Rotate Anticlockwise", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("E - Rotate Clockwise", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("S - Drop", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("< or Q - Rotate Anticlockwise", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("> or E- Rotate Clockwise", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("Left Arrow or D- Move Left", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("Right Arrow or A- Move Right", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("Up Arrow or W- Hard Drop", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("Down Arrow or S- Soft Drop", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("Shift or R- Switch Next", LARGE_INSET, offset += TEXT_STRIDE);
g.drawString("P - Pause Game", LARGE_INSET, offset += TEXT_STRIDE);

/*
Expand Down
Loading