Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Final Peoject
  • Loading branch information
JCS12011 committed May 2, 2015
0 parents commit 19be37d
Show file tree
Hide file tree
Showing 47 changed files with 2,134 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Knuckle's Adventure/.classpath
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="Resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="Libs/jl1.0.1.jar"/>
<classpathentry kind="lib" path="Libs/mp3spi1.9.5.jar"/>
<classpathentry kind="lib" path="Libs/tritonus_share.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions Knuckle's Adventure/.gitignore
@@ -0,0 +1 @@
/bin
17 changes: 17 additions & 0 deletions Knuckle's Adventure/.project
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Dragon Tale Tutorial</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions Knuckle's Adventure/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
#Sat Apr 13 11:56:25 EDT 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
Binary file added Knuckle's Adventure/Libs/jl1.0.1.jar
Binary file not shown.
Binary file added Knuckle's Adventure/Libs/mp3spi1.9.5.jar
Binary file not shown.
Binary file added Knuckle's Adventure/Libs/tritonus_share.jar
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Knuckle's Adventure/Resources/HUD/hud.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Knuckle's Adventure/Resources/Maps/level1-1.map
@@ -0,0 +1,10 @@
107
8
22 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
22 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 19 17 17 17 17 17 17 17 17 17 18 22 22 22 22 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 22 22 22 22 22 19 17 17 17 17 17 17 17 18 22
22 4 0 0 0 0 0 0 0 0 0 0 13 0 0 0 0 0 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 17 17 17 18 22 22 22 22 22 22 22 22 22 22 22 4 0 0 16 0 0 0 0 0 0 0 17 18 22 22 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 22 22 22 22 4 0 0 0 0 0 0 0 3 22
22 4 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 0 0 0 0 23 24 25 0 0 0 0 0 0 0 17 17 18 22 22 22 22 22 22 22 19 0 0 10 0 11 0 0 0 0 0 0 0 0 17 17 0 0 0 0 9 0 0 0 0 1 21 2 0 0 0 0 0 0 18 22 22 22 4 0 0 0 0 0 0 0 3 22
22 4 0 0 0 12 0 0 0 0 0 0 11 1 21 21 2 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 23 25 0 0 0 0 0 0 0 0 0 0 9 11 0 0 0 0 0 17 17 17 17 17 17 17 0 0 1 21 21 21 2 0 0 0 0 0 0 0 0 0 0 0 0 0 23 24 25 0 0 3 22 4 0 0 0 0 0 0 0 18 22 22 4 0 0 0 0 0 0 0 3 22
22 4 0 0 0 0 0 0 0 0 1 21 21 21 6 22 4 0 0 0 0 0 10 9 0 0 0 0 0 0 10 0 0 0 0 0 0 11 0 0 0 0 0 1 21 21 21 21 2 0 0 0 9 0 0 0 0 9 0 0 0 3 22 22 22 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 22 4 0 0 0 0 0 0 0 0 17 17 0 0 0 0 0 0 0 0 3 22
22 4 9 0 10 0 0 0 0 11 3 22 22 22 22 22 4 0 0 0 1 21 21 21 21 2 0 0 9 1 21 21 2 0 9 1 21 21 2 0 0 0 0 3 22 22 22 22 4 10 0 1 21 2 0 0 1 21 2 11 1 21 6 22 22 4 0 0 0 0 0 0 0 9 0 0 10 9 0 0 11 0 0 1 21 5 21 2 0 0 0 0 0 0 0 0 0 0 0 10 11 0 0 9 0 3 22
5 21 21 21 21 21 21 21 21 21 21 6 22 22 22 22 4 0 0 0 3 22 22 22 22 21 21 21 21 21 6 5 21 21 21 21 6 22 4 0 0 0 0 3 22 22 22 5 21 21 21 21 21 21 21 21 21 21 21 21 21 6 22 22 22 4 0 0 0 0 0 1 21 21 21 21 21 21 21 21 21 21 21 21 6 22 5 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 6
Binary file added Knuckle's Adventure/Resources/Menu/Emblem.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Knuckle's Adventure/Resources/Menu/Emblem2.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file added Knuckle's Adventure/Resources/Music/Intro.mp3
Binary file not shown.
Binary file not shown.
Binary file added Knuckle's Adventure/Resources/Music/Tee.mp3
Binary file not shown.
Binary file added Knuckle's Adventure/Resources/SFX/jump.mp3
Binary file not shown.
Binary file added Knuckle's Adventure/Resources/SFX/punch.mp3
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Knuckle's Adventure/Resources/Tilesets/Thumbs.db
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions Knuckle's Adventure/src/Audio/AudioPlayer.java
@@ -0,0 +1,71 @@
package Audio;

import javax.sound.sampled.*;

public class AudioPlayer {

private Clip clip;

public AudioPlayer(String s) {

try {

AudioInputStream ais =
AudioSystem.getAudioInputStream(
getClass().getResourceAsStream(
s
)
);
AudioFormat baseFormat = ais.getFormat();
AudioFormat decodeFormat = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
baseFormat.getSampleRate(),
16,
baseFormat.getChannels(),
baseFormat.getChannels() * 2,
baseFormat.getSampleRate(),
false
);
AudioInputStream dais =
AudioSystem.getAudioInputStream(
decodeFormat, ais);
clip = AudioSystem.getClip();
clip.open(dais);
}
catch(Exception e) {
e.printStackTrace();
}

}

public void play() {
if(clip == null) return;
stop();
clip.setFramePosition(0);
clip.start();
}

public void stop() {
if(clip.isRunning()) clip.stop();
}

public void close() {
stop();
clip.close();
}

}














65 changes: 65 additions & 0 deletions Knuckle's Adventure/src/Entity/Animation.java
@@ -0,0 +1,65 @@
package Entity;

import java.awt.image.BufferedImage;

public class Animation {

private BufferedImage[] frames;
private int currentFrame;

private long startTime;
private long delay;

private boolean playedOnce;

public Animation() {
playedOnce = false;
}

public void setFrames(BufferedImage[] frames) {
this.frames = frames;
currentFrame = 0;
startTime = System.nanoTime();
playedOnce = false;
}

public void setDelay(long d) { delay = d; }
public void setFrame(int i) { currentFrame = i; }

public void update() {

if(delay == -1) return;

long elapsed = (System.nanoTime() - startTime) / 1000000;
if(elapsed > delay) {
currentFrame++;
startTime = System.nanoTime();
}
if(currentFrame == frames.length) {
currentFrame = 0;
playedOnce = true;
}

}

public int getFrame() { return currentFrame; }
public BufferedImage getImage() { return frames[currentFrame]; }
public boolean hasPlayedOnce() { return playedOnce; }

}
















123 changes: 123 additions & 0 deletions Knuckle's Adventure/src/Entity/Blast.java
@@ -0,0 +1,123 @@
package Entity;

import TileMap.TileMap;

import java.awt.*;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;

public class Blast extends MapObject {

private boolean hit;
private boolean remove;
private BufferedImage[] sprites;
private BufferedImage[] hitSprites;

public Blast(TileMap tm, boolean right) {

super(tm);

facingRight = right;

moveSpeed = 3.8;
if(right) dx = moveSpeed;
else dx = -moveSpeed;

width = 16;
height = 16;
cwidth = 14;
cheight = 14;

// load sprites
try {

BufferedImage spritesheet = ImageIO.read(
getClass().getResourceAsStream(
"/Sprites/Player/rings ss.gif"
)
);

sprites = new BufferedImage[8];
for(int i = 0; i < sprites.length; i++) {
sprites[i] = spritesheet.getSubimage(
i * width,
0,
width,
height
);
}

hitSprites = new BufferedImage[7];
for(int i = 0; i < hitSprites.length; i++) {
hitSprites[i] = spritesheet.getSubimage(
i * width,
height,
width,
height
);
}

animation = new Animation();
animation.setFrames(sprites);
animation.setDelay(70);

}
catch(Exception e) {
e.printStackTrace();
}

}

public void setHit() {
if(hit) return;
hit = true;
animation.setFrames(hitSprites);
animation.setDelay(70);
dx = 0;
}

public boolean shouldRemove() { return remove; }

public void update() {

checkTileMapCollision();
setPosition(xtemp, ytemp);

if(dx == 0 && !hit) {
setHit();
}

animation.update();
if(hit && animation.hasPlayedOnce()) {
remove = true;
}

}

public void draw(Graphics2D g) {

setMapPosition();

super.draw(g);

}

}


















0 comments on commit 19be37d

Please sign in to comment.