From 09648ac756471368868af63b7992207a4141930c Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Wed, 24 Aug 2016 13:38:43 +0100 Subject: [PATCH 01/10] Projectile Colour and accuracy change --- build.gradle | 2 +- src/com/redomar/game/Game.java | 2 +- src/com/redomar/game/InputHandler.java | 2 +- src/com/redomar/game/entities/Player.java | 2 +- src/com/redomar/game/entities/projectiles/Projectile.java | 2 +- src/com/redomar/game/entities/projectiles/Small.java | 2 +- src/com/redomar/game/objects/Items.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 06de79d..2b8e6da 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ sourceSets.main.resources.srcDirs 'res' dependencies{ compile 'org.apache.commons:commons-lang3:3.4' compile 'javazoom:jlayer:1.0.1' - compile 'junit:junit:4.12' + testCompile 'junit:junit:4.12' compile files('res/jars/JSplashScreen.jar') } diff --git a/src/com/redomar/game/Game.java b/src/com/redomar/game/Game.java index 2c2a7d2..260d1cd 100644 --- a/src/com/redomar/game/Game.java +++ b/src/com/redomar/game/Game.java @@ -478,7 +478,7 @@ public void render() { g.drawString( "Welcome " + WordUtils.capitalizeFully(player - .getSantizedUsername()), 3, getHeight() - 17); + .getSanitisedUsername()), 3, getHeight() - 17); g.setColor(Color.ORANGE); if (context.getLocale().getCountry().equals("BE") diff --git a/src/com/redomar/game/InputHandler.java b/src/com/redomar/game/InputHandler.java index 91ce83d..b83a5e1 100644 --- a/src/com/redomar/game/InputHandler.java +++ b/src/com/redomar/game/InputHandler.java @@ -130,7 +130,7 @@ private void quitGame() { e.printStackTrace(); } Game.getLevel().removeEntity( - Game.getPlayer().getSantizedUsername()); + Game.getPlayer().getSanitisedUsername()); Game.setRunning(false); Game.getFrame().dispose(); System.exit(1); diff --git a/src/com/redomar/game/entities/Player.java b/src/com/redomar/game/entities/Player.java index 7e4db4b..682d004 100644 --- a/src/com/redomar/game/entities/Player.java +++ b/src/com/redomar/game/entities/Player.java @@ -213,7 +213,7 @@ public void setUsername(String name) { this.userName = name; } - public String getSantizedUsername() { + public String getSanitisedUsername() { if (this.getUsername() == null || this.userName.isEmpty()) { setUsername(guestPlayerName); return guestPlayerName; diff --git a/src/com/redomar/game/entities/projectiles/Projectile.java b/src/com/redomar/game/entities/projectiles/Projectile.java index 9798d55..93285dc 100644 --- a/src/com/redomar/game/entities/projectiles/Projectile.java +++ b/src/com/redomar/game/entities/projectiles/Projectile.java @@ -20,7 +20,7 @@ public Projectile(LevelHandler level, int x, int y, double dir) { super(level); xOrigin = x; yOrigin = y; - angle = dir; + angle = dir + (Math.random() * (dir + 0.2)); this.x = x; this.y = y; } diff --git a/src/com/redomar/game/entities/projectiles/Small.java b/src/com/redomar/game/entities/projectiles/Small.java index 20a2de0..4519f33 100644 --- a/src/com/redomar/game/entities/projectiles/Small.java +++ b/src/com/redomar/game/entities/projectiles/Small.java @@ -33,7 +33,7 @@ protected void move(){ } public void render(Screen screen) { - screen.render((int)x,(int)y, 8 * 32, Colours.get(-1, 222, 333, 555), 0x00, 1); + screen.render((int)x,(int)y, 8 * 32, Colours.get(-1, 522, 540, 555), 0x00, 1); } } diff --git a/src/com/redomar/game/objects/Items.java b/src/com/redomar/game/objects/Items.java index 1726d0f..2bb4ffc 100644 --- a/src/com/redomar/game/objects/Items.java +++ b/src/com/redomar/game/objects/Items.java @@ -4,5 +4,5 @@ public enum Items { Stick, Torch, Sword, - Apple; + Apple } From b6b8a59bdb732d6829d19874f2e5e4e808e2aee1 Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 13:16:26 +0100 Subject: [PATCH 02/10] updated readme removed an erlier change to accuracy --- README.md | 11 ++++++----- .../redomar/game/entities/projectiles/Projectile.java | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9410fee..fc5e3b0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -JavaGame Alpha v1.8.2 [![Travis-CI Build Status](https://travis-ci.org/redomar/JavaGame.svg?branch=master)](https://travis-ci.org/redomar/JavaGame) -===================== -Acknowledgement: Inspired from [vanZeben](https://github.com/vanZeben) +JavaGame [![GitHub release](https://img.shields.io/github/release/redomar/JavaGame.svg?style=flat-square&label=Alpha)](https://github.com/redomar/JavaGame/releases/latest) [![Travis-CI Build Status](https://img.shields.io/travis/redomar/JavaGame.svg?style=flat-square)](https://travis-ci.org/redomar/JavaGame) [![GitHub license](https://img.shields.io/badge/license-AGPLv3-red.svg?style=flat-square)](https://raw.githubusercontent.com/Redomar/JavaGame/master/LICENSE) +== #####What is JavaGame? JavaGame is a game project that have been working on since May 2013. I have added many features to the game over the last year and I plan on adding even more features. This game is purely for my own sake to practice my skills in Java. @@ -10,9 +9,9 @@ Well i'm still not sure what exactly i'm going to do with it, and I haven't thou #####Play the Game * For latest version get - * [v1.8](https://github.com/redomar/JavaGame/releases/tag/v1.8) + * [![GitHub release](https://img.shields.io/github/release/redomar/JavaGame.svg?style=flat-square&label=Alpha)](https://github.com/redomar/JavaGame/releases/latest) * For multiplayer enabled get - * [v1.5.4](https://github.com/redomar/JavaGame/releases/tag/v1.5.4) + * [![GitHub release](https://img.shields.io/badge/Alpha-v1.5.4-cc0000.svg)](https://github.com/redomar/JavaGame/releases/v1.5.4) #####Your version naming is all wrong Yes, I recently noticed that there is a standard called Semantic Versioning that I should follow. Currently my project isn't organised as well as I hoped so starting from the Beta I will follow Semantic Versioning schema. @@ -36,3 +35,5 @@ Watch this video [here](http://youtu.be/_3nCgac3KKM) or checkout the [GitHub Pag * Commit your changes (```git commit -m "Change Title"```) * Push to the branch (```git push origin my_branch```) * Open a [Pull Request](https://github.com/redomar/JavaGame/pull/new/master) + +Inspired from [vanZeben](https://github.com/vanZeben). \ No newline at end of file diff --git a/src/com/redomar/game/entities/projectiles/Projectile.java b/src/com/redomar/game/entities/projectiles/Projectile.java index 93285dc..9798d55 100644 --- a/src/com/redomar/game/entities/projectiles/Projectile.java +++ b/src/com/redomar/game/entities/projectiles/Projectile.java @@ -20,7 +20,7 @@ public Projectile(LevelHandler level, int x, int y, double dir) { super(level); xOrigin = x; yOrigin = y; - angle = dir + (Math.random() * (dir + 0.2)); + angle = dir; this.x = x; this.y = y; } From 4acbd26f61960244a00e7d206588bc20feb6bd21 Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 15:34:19 +0100 Subject: [PATCH 03/10] Added new unit tests for printing class Removed .log.txt file after game closes (only readable while open) Updated .travis.yml to allocate tests for unitTeststing branch --- .travis.yml | 3 +- build.gradle | 11 ++++- src/com/redomar/game/InputHandler.java | 1 + src/com/redomar/game/script/PrintTypes.java | 3 +- src/com/redomar/game/script/Printing.java | 15 +++++- .../redomar/game/script/PrintToLogTest.java | 7 +-- .../com/redomar/game/script/PrintingTest.java | 48 +++++++++++++++++++ 7 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 test/com/redomar/game/script/PrintingTest.java diff --git a/.travis.yml b/.travis.yml index 15cf937..7ae46d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,4 @@ language: java # blocklist branches: except: - - develop - - unitTesting \ No newline at end of file + - develop \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2b8e6da..89da07b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,15 @@ repositories{ apply plugin: 'java' -sourceSets.main.java.srcDir 'src' -sourceSets.main.resources.srcDirs 'res' +sourceSets{ + main{ + java.srcDir 'src' + resources.srcDir 'res' + } + test{ + java.srcDir 'test' + } +} dependencies{ compile 'org.apache.commons:commons-lang3:3.4' diff --git a/src/com/redomar/game/InputHandler.java b/src/com/redomar/game/InputHandler.java index b83a5e1..e65dd50 100644 --- a/src/com/redomar/game/InputHandler.java +++ b/src/com/redomar/game/InputHandler.java @@ -124,6 +124,7 @@ private void toggleKey(int keyCode, boolean isPressed) { private void quitGame() { Game.setClosing(true); + print.removeLog(); try { Thread.sleep(1000); } catch (InterruptedException e) { diff --git a/src/com/redomar/game/script/PrintTypes.java b/src/com/redomar/game/script/PrintTypes.java index e192e44..0a366a5 100644 --- a/src/com/redomar/game/script/PrintTypes.java +++ b/src/com/redomar/game/script/PrintTypes.java @@ -5,6 +5,7 @@ public enum PrintTypes { LEVEL, MUSIC, ERROR, + TEST, NETWORK, - SERVER; + SERVER } diff --git a/src/com/redomar/game/script/Printing.java b/src/com/redomar/game/script/Printing.java index 7b4f2bb..e5c6ecd 100644 --- a/src/com/redomar/game/script/Printing.java +++ b/src/com/redomar/game/script/Printing.java @@ -2,6 +2,7 @@ import com.redomar.game.lib.Time; +import java.io.File; import java.util.Arrays; public class Printing { @@ -30,7 +31,7 @@ private void printOut(){ msgTime = "[" + time.getTime() + "]"; msgType = "[" + type.toString() + "]"; - logFile = new PrintToLog(".log.txt"); + logFile = printToLogType(type); if (lineNumber == 0) { String dashes = ""; @@ -56,6 +57,18 @@ private void printOut(){ } } + private PrintToLog printToLogType(PrintTypes type){ + if (type == PrintTypes.TEST){ + return new PrintToLog(".PrintType-TEST.txt"); + } else { + return new PrintToLog(".log.txt"); + } + } + + public void removeLog(){ + new File(".log.txt").delete() + } + public String getMessage() { return message; } diff --git a/test/com/redomar/game/script/PrintToLogTest.java b/test/com/redomar/game/script/PrintToLogTest.java index 5898dc0..ecc651e 100644 --- a/test/com/redomar/game/script/PrintToLogTest.java +++ b/test/com/redomar/game/script/PrintToLogTest.java @@ -2,6 +2,7 @@ import org.junit.Test; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** @@ -11,7 +12,7 @@ */ public class PrintToLogTest { - PrintToLog print; + private PrintToLog print; @Test(expected = NullPointerException.class) public void PrintToLogNullFile() { @@ -20,9 +21,9 @@ public void PrintToLogNullFile() { @Test public void PrintToLogDoesWork() { - print = new PrintToLog(".Test.txt"); + print = new PrintToLog(".PrintToLogDoesWork.txt"); assertTrue(print.getUrl().exists()); - print.getUrl().delete(); + assertTrue(print.getUrl().delete()); } } diff --git a/test/com/redomar/game/script/PrintingTest.java b/test/com/redomar/game/script/PrintingTest.java new file mode 100644 index 0000000..ab38469 --- /dev/null +++ b/test/com/redomar/game/script/PrintingTest.java @@ -0,0 +1,48 @@ +package com.redomar.game.script; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.File; + +import static org.junit.Assert.*; + +/** + * Created by Mohamed on 28/08/2016. + * This file tests the com.redomar.game.script.Printing class + */ +public class PrintingTest { + + private Printing printing; + + @Before + public void setUp() throws Exception { + printing = new Printing(); + } + + @Test + public void printToFileWorks() throws Exception { + printing.print("TESTING STRING", PrintTypes.TEST); + File file = new File(".PrintType-TEST.txt"); + assertTrue(file.exists()); + assertTrue(file.delete()); + } + + @Test + public void getMessageIsNull() { + assertNull(printing.getMessage()); + } + + @Test + public void getMessageIsNotNull() { + printing.setMessage("Not Null"); + assertNotNull(printing.getMessage()); + } + + @After + public void cleanUp(){ + printing = null; + } + +} \ No newline at end of file From e6a270d82fd09fa4f97b8967ce75b4cd0d5cb56c Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 18:09:42 +0100 Subject: [PATCH 04/10] Removed music class --- src/com/redomar/game/Game.java | 49 -------------- src/com/redomar/game/InputHandler.java | 11 +-- src/com/redomar/game/lib/Music.java | 81 ----------------------- src/com/redomar/game/script/Printing.java | 2 +- 4 files changed, 2 insertions(+), 141 deletions(-) delete mode 100644 src/com/redomar/game/lib/Music.java diff --git a/src/com/redomar/game/Game.java b/src/com/redomar/game/Game.java index 260d1cd..18f3e4f 100644 --- a/src/com/redomar/game/Game.java +++ b/src/com/redomar/game/Game.java @@ -7,7 +7,6 @@ import com.redomar.game.gfx.SpriteSheet; import com.redomar.game.level.LevelHandler; import com.redomar.game.lib.Font; -import com.redomar.game.lib.Music; import com.redomar.game.lib.Time; import com.redomar.game.script.PrintTypes; import com.redomar.game.script.Printing; @@ -66,12 +65,9 @@ public class Game extends Canvas implements Runnable { private Player player; private Dummy dummy; private Vendor vendor; - private Music music = new Music(); private Font font = new Font(); - private Thread musicThread = new Thread(music, "MUSIC"); private String nowPlaying; private boolean notActive = true; - private boolean noAudioDevice = false; private int trigger = 0; private Printing print = new Printing(); @@ -425,22 +421,6 @@ public void render() { } } - if (!noAudioDevice) { - if (input.isPlayMusic() && notActive == true) { - int musicOption = JOptionPane.showConfirmDialog(this, - "You are about to turn on music and can be VERY loud", - "Music Options", 2, 2); - if (musicOption == 0) { - musicThread.start(); - notActive = false; - } else { - // System.out.println("[GAME] Canceled music option"); - print.print(" Canceled music option", PrintTypes.GAME); - input.setPlayMusic(false); - } - } - } - if (isChangeLevel() == true && getTickCount() % 60 == 0) { Game.setChangeLevel(true); setChangeLevel(false); @@ -492,35 +472,6 @@ public void render() { g.setColor(Color.YELLOW); g.drawString(time.getTime(), (getWidth() - 58), (getHeight() - 3)); g.setColor(Color.WHITE); - if (noAudioDevice == true) { - g.setColor(Color.RED); - g.drawString("MUSIC is OFF | no audio device for playback", 3, - getHeight() - 3); - trigger++; - if (trigger == 25) { - JOptionPane.showMessageDialog(this, "No Audio device found", - "Audio Issue", 0); - } - } else if (notActive == true) { - g.setColor(Color.RED); - g.drawString("MUSIC is OFF | press 'M' to start", 3, - getHeight() - 3); - } else { - g.setColor(Color.GREEN); - g.drawString("MUSIC is ON | You cannot turn off the music", 3, - getHeight() - 3); - g.setColor(Color.WHITE); - setNowPlaying(WordUtils.capitalize(music.getSongName()[music - .getSongNumber()].substring(7, - (music.getSongName()[music.getSongNumber()].length() - 4)))); - if (getNowPlaying().startsWith("T")) { - g.drawString(nowPlaying, getWidth() - (nowPlaying.length() * 9) - + 12, getHeight() - 17); - } else { - g.drawString(nowPlaying, getWidth() - (nowPlaying.length() * 9) - + 8, getHeight() - 17); - } - } g.dispose(); bs.show(); } diff --git a/src/com/redomar/game/InputHandler.java b/src/com/redomar/game/InputHandler.java index e65dd50..a14de4f 100644 --- a/src/com/redomar/game/InputHandler.java +++ b/src/com/redomar/game/InputHandler.java @@ -17,7 +17,6 @@ public class InputHandler implements KeyListener { private Key left = new Key(); private Key right = new Key(); private Printing print = new Printing(); - private boolean PlayMusic = false; private int map; private boolean ignoreInput = false; private PopUp popup = new PopUp(); @@ -70,7 +69,7 @@ private void toggleKey(int keyCode, boolean isPressed) { right.toggle(false); } if (keyCode == KeyEvent.VK_M) { - this.setPlayMusic(true); + //music here } if (keyCode == KeyEvent.VK_W && isAzertyCountry || keyCode == KeyEvent.VK_Z && !isAzertyCountry) { @@ -149,14 +148,6 @@ public void setMap(int map) { this.map = map; } - boolean isPlayMusic() { - return PlayMusic; - } - - void setPlayMusic(boolean playMusic) { - PlayMusic = playMusic; - } - public Key getUp() { return up; } diff --git a/src/com/redomar/game/lib/Music.java b/src/com/redomar/game/lib/Music.java deleted file mode 100644 index 1c780fe..0000000 --- a/src/com/redomar/game/lib/Music.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.redomar.game.lib; - -import com.redomar.game.Game; -import com.redomar.game.script.PrintTypes; -import com.redomar.game.script.Printing; -import javazoom.jl.player.Player; - -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.util.Random; - -public class Music implements Runnable { - - private static String songName[] = { "/music/Towards The End.mp3", - "/music/Towards The End.mp3", "/music/Towards The End.mp3" }; - private static int songNumber; - private static Random rand = new Random(); - private InputStream file; - private Player musicPlayer; - private Printing print = new Printing(); - - public Music(InputStream url) { - this.file = url; - } - - public Music() { - Music.songNumber = rand.nextInt(3); - } - - public void Play() { - try { - BufferedInputStream buffered = new BufferedInputStream(file); - musicPlayer = new Player(buffered); - musicPlayer.play(); - } catch (Exception e) { - print.print(" Problem playing file " + file, PrintTypes.ERROR); - print.print(e.toString(), PrintTypes.ERROR); - } - } - - public synchronized void start() { - this.run(); - } - - @Override - public void run() { - try { - Thread.sleep(300); - initSongNumber(); - // System.out.println("[MUSIC] loading song: " + - // songName[songNumber].substring(7, (songName[songNumber].length() - // - 4))); - Music music = new Music( - Game.class.getResourceAsStream(songName[songNumber])); - // Thread.sleep(100); - print.print(" Playing song: " - + songName[songNumber].substring(7, - (songName[songNumber].length() - 4)), PrintTypes.MUSIC); - music.Play(); - this.run(); - } catch (InterruptedException e) { - print.print(" Could not stop, nothing currenly playing", PrintTypes.ERROR); - } - } - - public void stop() { - - } - - private void initSongNumber() { - Music.songNumber = rand.nextInt(3); - } - - public String[] getSongName() { - return songName; - } - - public int getSongNumber() { - return songNumber; - } -} diff --git a/src/com/redomar/game/script/Printing.java b/src/com/redomar/game/script/Printing.java index e5c6ecd..aba3de7 100644 --- a/src/com/redomar/game/script/Printing.java +++ b/src/com/redomar/game/script/Printing.java @@ -66,7 +66,7 @@ private PrintToLog printToLogType(PrintTypes type){ } public void removeLog(){ - new File(".log.txt").delete() + new File(".log.txt").delete(); } public String getMessage() { From 43cb196d2f262e519d27a53204221e1c56bcc991 Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 18:57:28 +0100 Subject: [PATCH 05/10] Added new Audio Handler Updated gradle to add new depo's --- build.gradle | 4 +- src/com/redomar/game/audio/AudioHandler.java | 50 ++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/com/redomar/game/audio/AudioHandler.java diff --git a/build.gradle b/build.gradle index 89da07b..866ad21 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,9 @@ sourceSets{ dependencies{ compile 'org.apache.commons:commons-lang3:3.4' - compile 'javazoom:jlayer:1.0.1' + compile('com.googlecode.soundlibs:mp3spi:1.9.5-1'){ + exclude module: 'junit' + } testCompile 'junit:junit:4.12' compile files('res/jars/JSplashScreen.jar') } diff --git a/src/com/redomar/game/audio/AudioHandler.java b/src/com/redomar/game/audio/AudioHandler.java new file mode 100644 index 0000000..ce61035 --- /dev/null +++ b/src/com/redomar/game/audio/AudioHandler.java @@ -0,0 +1,50 @@ +package com.redomar.game.audio; + +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; + + +public class AudioHandler { + + private Clip clip; + + public AudioHandler(String path){ + try{ + AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(getClass().getResourceAsStream(path)); + AudioFormat baseformat = audioInputStream.getFormat(); + AudioFormat decodeFormat = new AudioFormat( + AudioFormat.Encoding.PCM_SIGNED, + baseformat.getSampleRate(), 16, + baseformat.getChannels(), + baseformat.getChannels() * 2, + baseformat.getSampleRate(), + false + ); + AudioInputStream decodedAudioInputStream = AudioSystem.getAudioInputStream( + decodeFormat, audioInputStream); + clip = AudioSystem.getClip(); + clip.open(decodedAudioInputStream); + } catch (Exception e){ + System.err.println(e.getStackTrace()); + } + } + + 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(); + } + +} From 6ac82fa60539b000bc4105f153b35729ee07a39f Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 19:33:38 +0100 Subject: [PATCH 06/10] Added sound effect class for uncompressed audio files --- src/com/redomar/game/audio/AudioEffect.java | 46 ++++++++++++++++++++ src/com/redomar/game/audio/AudioHandler.java | 11 +++-- 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/com/redomar/game/audio/AudioEffect.java diff --git a/src/com/redomar/game/audio/AudioEffect.java b/src/com/redomar/game/audio/AudioEffect.java new file mode 100644 index 0000000..6a5e6ef --- /dev/null +++ b/src/com/redomar/game/audio/AudioEffect.java @@ -0,0 +1,46 @@ +package com.redomar.game.audio; + +import javax.sound.sampled.*; + +/** + * For uncompressed files like .wav + */ +public class AudioEffect{ + + Clip clip; + + public AudioEffect(String path){ + try { + AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(getClass().getResourceAsStream(path)); + AudioFormat baseformat = audioInputStream.getFormat(); + AudioInputStream decodedAudioInputStream = AudioSystem.getAudioInputStream( + baseformat, audioInputStream); + clip = AudioSystem.getClip(); + clip.open(decodedAudioInputStream); + } catch (Exception e){ + System.err.println(e.getStackTrace()); + } + } + + public void play(){ + if(clip == null) return; + stop(); + clip.setFramePosition(0); + clip.start(); + } + + public void setVolume(float velocity){ + FloatControl volume = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN); + volume.setValue(velocity); + + } + + public void stop() { + if (clip.isRunning()) clip.stop(); + } + + public void close(){ + stop(); + clip.close(); + } +} diff --git a/src/com/redomar/game/audio/AudioHandler.java b/src/com/redomar/game/audio/AudioHandler.java index ce61035..335fe4b 100644 --- a/src/com/redomar/game/audio/AudioHandler.java +++ b/src/com/redomar/game/audio/AudioHandler.java @@ -1,9 +1,6 @@ package com.redomar.game.audio; -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.Clip; +import javax.sound.sampled.*; public class AudioHandler { @@ -38,6 +35,12 @@ public void play(){ clip.start(); } + public void setVolume(float velocity){ + FloatControl volume = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN); + volume.setValue(velocity); + + } + public void stop() { if (clip.isRunning()) clip.stop(); } From 437d9d8913f72b1e32547277a3830b4d9d28a943 Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 20:24:56 +0100 Subject: [PATCH 07/10] Added background music and projectile sound effect --- res/sfx/smallProjectile.wav | Bin 0 -> 10188 bytes src/com/redomar/game/Game.java | 20 +++++++-- src/com/redomar/game/InputHandler.java | 8 +++- src/com/redomar/game/audio/AudioHandler.java | 7 ++++ src/com/redomar/game/entities/Player.java | 13 ++++++ src/com/redomar/game/menu/Menu.java | 41 ++++++++----------- 6 files changed, 60 insertions(+), 29 deletions(-) create mode 100644 res/sfx/smallProjectile.wav diff --git a/res/sfx/smallProjectile.wav b/res/sfx/smallProjectile.wav new file mode 100644 index 0000000000000000000000000000000000000000..4409a3ebc96df87016ab688191ae7b4128128e28 GIT binary patch literal 10188 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 T14#o(14#o(14#q_pMn1Yy|3`W literal 0 HcmV?d00001 diff --git a/src/com/redomar/game/Game.java b/src/com/redomar/game/Game.java index 18f3e4f..a3bcf80 100644 --- a/src/com/redomar/game/Game.java +++ b/src/com/redomar/game/Game.java @@ -1,5 +1,6 @@ package com.redomar.game; +import com.redomar.game.audio.AudioHandler; import com.redomar.game.entities.Dummy; import com.redomar.game.entities.Player; import com.redomar.game.entities.Vendor; @@ -46,7 +47,7 @@ public class Game extends Canvas implements Runnable { private static boolean closingMode; private static JFrame frame; - + private static AudioHandler backgroundMusic; private static boolean running = false; private static InputHandler input; private static MouseHandler mouse; @@ -260,14 +261,22 @@ public static void setAlternateCols(boolean[] alternateCols) { Game.alternateCols = alternateCols; } - public static void setAternateColsR(boolean alternateCols) { + public static void setAlternateColsR(boolean alternateCols) { Game.alternateCols[1] = alternateCols; } - public static void setAternateColsS(boolean alternateCols) { + public static void setAlternateColsS(boolean alternateCols) { Game.alternateCols[0] = alternateCols; } + public static void setBackgroundMusic(AudioHandler backgroundMusic) { + Game.backgroundMusic = backgroundMusic; + } + + public static AudioHandler getBackgroundMusic(){ + return Game.backgroundMusic; + } + public static InputHandler getInput() { return input; } @@ -471,7 +480,10 @@ public void render() { } g.setColor(Color.YELLOW); g.drawString(time.getTime(), (getWidth() - 58), (getHeight() - 3)); - g.setColor(Color.WHITE); + g.setColor(Color.GREEN); + if(backgroundMusic.getActive()) { + g.drawString("MUSIC is ON ", 3, getHeight() - 3); + } g.dispose(); bs.show(); } diff --git a/src/com/redomar/game/InputHandler.java b/src/com/redomar/game/InputHandler.java index a14de4f..92152c9 100644 --- a/src/com/redomar/game/InputHandler.java +++ b/src/com/redomar/game/InputHandler.java @@ -68,10 +68,16 @@ private void toggleKey(int keyCode, boolean isPressed) { left.toggle(false); right.toggle(false); } + if (keyCode == KeyEvent.VK_M) { - //music here + Game.getBackgroundMusic().play(); + } + + if (keyCode == KeyEvent.VK_COMMA) { + Game.getBackgroundMusic().stop(); } + if (keyCode == KeyEvent.VK_W && isAzertyCountry || keyCode == KeyEvent.VK_Z && !isAzertyCountry) { // if (map == 0){ // Game.getGame().setMap("/levels/water_level.png"); diff --git a/src/com/redomar/game/audio/AudioHandler.java b/src/com/redomar/game/audio/AudioHandler.java index 335fe4b..d1a705e 100644 --- a/src/com/redomar/game/audio/AudioHandler.java +++ b/src/com/redomar/game/audio/AudioHandler.java @@ -6,6 +6,7 @@ public class AudioHandler { private Clip clip; + private boolean active = false; public AudioHandler(String path){ try{ @@ -33,6 +34,7 @@ public void play(){ stop(); clip.setFramePosition(0); clip.start(); + active = true; } public void setVolume(float velocity){ @@ -43,6 +45,7 @@ public void setVolume(float velocity){ public void stop() { if (clip.isRunning()) clip.stop(); + active = false; } public void close(){ @@ -50,4 +53,8 @@ public void close(){ clip.close(); } + public boolean getActive(){ + return this.active; + } + } diff --git a/src/com/redomar/game/entities/Player.java b/src/com/redomar/game/entities/Player.java index 682d004..c54471f 100644 --- a/src/com/redomar/game/entities/Player.java +++ b/src/com/redomar/game/entities/Player.java @@ -2,6 +2,7 @@ import com.redomar.game.Game; import com.redomar.game.InputHandler; +import com.redomar.game.audio.AudioEffect; import com.redomar.game.entities.efx.Swim; import com.redomar.game.entities.projectiles.Medium; import com.redomar.game.entities.projectiles.Projectile; @@ -28,6 +29,8 @@ public class Player extends Mob { private int[] swimColour; private int fireRate = 0; + private static AudioEffect shootSound; + public Player(LevelHandler level, int x, int y, InputHandler input, String userName, int shirtCol, int faceCol) { super(level, "Player", x, y, speed, collisionBoders); @@ -72,6 +75,8 @@ public void tick() { if(fireRate <= 0){ if(Game.getMouse().getButton()== 1){ fireRate = Small.FIRE_RATE; + shootSound.setVolume(-15); + shootSound.play(); }else if(Game.getMouse().getButton() == 3){ fireRate = Medium.FIRE_RATE; } @@ -202,6 +207,14 @@ public void render(Screen screen) { } } + public static AudioEffect getShootSound() { + return shootSound; + } + + public static void setShootSound(AudioEffect shootSound) { + Player.shootSound = shootSound; + } + public String getUsername() { if (this.userName.isEmpty()) { return guestPlayerName; diff --git a/src/com/redomar/game/menu/Menu.java b/src/com/redomar/game/menu/Menu.java index 6defd4d..d0ac16d 100644 --- a/src/com/redomar/game/menu/Menu.java +++ b/src/com/redomar/game/menu/Menu.java @@ -1,6 +1,9 @@ package com.redomar.game.menu; import com.redomar.game.Game; +import com.redomar.game.audio.AudioEffect; +import com.redomar.game.audio.AudioHandler; +import com.redomar.game.entities.Player; import com.redomar.game.lib.Font; import com.redomar.game.lib.Mouse; import com.thehowtotutorial.splashscreen.JSplash; @@ -46,23 +49,13 @@ public static void play() { splash.toFront(); splash.requestFocus(); splash.splashOn(); - splash.setProgress(10, "Initializing Game"); - Thread.sleep(250); - splash.setProgress(25, "Loading Classes"); - Thread.sleep(125); - splash.setProgress(35, "Applying Configurations"); - Thread.sleep(125); - splash.setProgress(40, "Loading Sprites"); - Thread.sleep(250); - splash.setProgress(50, "Loading Textures"); - Thread.sleep(125); - splash.setProgress(60, "Loading Map"); - Thread.sleep(500); - splash.setProgress(80, "Configuring Map"); - Thread.sleep(125); - splash.setProgress(90, "Pulling InputPanes"); - Thread.sleep(250); - splash.setProgress(92, "Acquiring data: Multiplayer"); + splash.setProgress(10, "Initializing SFX"); + Player.setShootSound( new AudioEffect("/sfx/smallProjectile.wav")); + splash.setProgress(30, "Loading Music"); + Game.setBackgroundMusic(new AudioHandler("/music/Towards The End.mp3")); + splash.setProgress(40, "Setting Volume"); + Game.getBackgroundMusic().setVolume(-20); + splash.setProgress(50, "Acquiring data: Multiplayer"); Thread.sleep(125); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); String multiMsg = "Sorry but multiplayer has been disabled on this version.\nIf you would like multiplayer checkout Alpha 1.6"; @@ -76,23 +69,23 @@ public static void play() { "Enter the name \nleave blank for local")); } Thread.sleep(125); - splash.setProgress(94, "Acquiring data: Username"); + splash.setProgress(70, "Acquiring data: Username"); String s = JOptionPane.showInputDialog(Game.getGame(), "Enter a name"); if (s != null) { Game.setJdata_UserName(s); } Thread.sleep(125); - splash.setProgress(96, "Collecting Player Data"); + splash.setProgress(90, "Collecting Player Data"); Object[] options = {"African", "Caucasian"}; int n = JOptionPane.showOptionDialog(frame, "Choose a race for the charater to be", "Choose a race", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (n == 0) { - Game.setAternateColsR(true); + Game.setAlternateColsR(true); } else { - Game.setAternateColsR(false); + Game.setAlternateColsR(false); } Thread.sleep(250); Object[] options1 = {"Orange", "Black"}; @@ -101,11 +94,11 @@ public static void play() { "Choose a shirt Colour", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, options1[0]); if (n1 == 0) { - Game.setAternateColsS(true); + Game.setAlternateColsS(true); } else { - Game.setAternateColsS(false); + Game.setAlternateColsS(false); } - splash.setProgress(97, "Connecting as" + Game.getJdata_UserName()); + splash.setProgress(100, "Connecting as" + Game.getJdata_UserName()); Thread.sleep(250); splash.splashOff(); frame = new DedicatedJFrame(WIDTH, HEIGHT, SCALE, NAME); From 6cf259a602964800c194985beaf10301cecc331c Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 21:43:07 +0100 Subject: [PATCH 08/10] Added tests for audio --- src/com/redomar/game/audio/AudioEffect.java | 14 ++++++++-- src/com/redomar/game/entities/Player.java | 12 -------- .../game/entities/projectiles/Small.java | 9 +++++- src/com/redomar/game/menu/Menu.java | 2 +- .../redomar/game/audio/AudioEffectTest.java | 28 +++++++++++++++++++ .../redomar/game/audio/AudioHandlerTest.java | 22 +++++++++++++++ 6 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 test/com/redomar/game/audio/AudioEffectTest.java create mode 100644 test/com/redomar/game/audio/AudioHandlerTest.java diff --git a/src/com/redomar/game/audio/AudioEffect.java b/src/com/redomar/game/audio/AudioEffect.java index 6a5e6ef..3442796 100644 --- a/src/com/redomar/game/audio/AudioEffect.java +++ b/src/com/redomar/game/audio/AudioEffect.java @@ -7,10 +7,11 @@ */ public class AudioEffect{ - Clip clip; + private Clip clip; + private boolean active = false; public AudioEffect(String path){ - try { + try{ AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(getClass().getResourceAsStream(path)); AudioFormat baseformat = audioInputStream.getFormat(); AudioInputStream decodedAudioInputStream = AudioSystem.getAudioInputStream( @@ -27,6 +28,7 @@ public void play(){ stop(); clip.setFramePosition(0); clip.start(); + active = true; } public void setVolume(float velocity){ @@ -37,10 +39,16 @@ public void setVolume(float velocity){ public void stop() { if (clip.isRunning()) clip.stop(); + active = false; } public void close(){ stop(); clip.close(); } -} + + public boolean getActive(){ + return this.active; + } + +} \ No newline at end of file diff --git a/src/com/redomar/game/entities/Player.java b/src/com/redomar/game/entities/Player.java index c54471f..245b675 100644 --- a/src/com/redomar/game/entities/Player.java +++ b/src/com/redomar/game/entities/Player.java @@ -29,8 +29,6 @@ public class Player extends Mob { private int[] swimColour; private int fireRate = 0; - private static AudioEffect shootSound; - public Player(LevelHandler level, int x, int y, InputHandler input, String userName, int shirtCol, int faceCol) { super(level, "Player", x, y, speed, collisionBoders); @@ -75,8 +73,6 @@ public void tick() { if(fireRate <= 0){ if(Game.getMouse().getButton()== 1){ fireRate = Small.FIRE_RATE; - shootSound.setVolume(-15); - shootSound.play(); }else if(Game.getMouse().getButton() == 3){ fireRate = Medium.FIRE_RATE; } @@ -207,14 +203,6 @@ public void render(Screen screen) { } } - public static AudioEffect getShootSound() { - return shootSound; - } - - public static void setShootSound(AudioEffect shootSound) { - Player.shootSound = shootSound; - } - public String getUsername() { if (this.userName.isEmpty()) { return guestPlayerName; diff --git a/src/com/redomar/game/entities/projectiles/Small.java b/src/com/redomar/game/entities/projectiles/Small.java index 4519f33..6cbddc5 100644 --- a/src/com/redomar/game/entities/projectiles/Small.java +++ b/src/com/redomar/game/entities/projectiles/Small.java @@ -1,12 +1,13 @@ package com.redomar.game.entities.projectiles; +import com.redomar.game.audio.AudioEffect; import com.redomar.game.gfx.Colours; import com.redomar.game.gfx.Screen; import com.redomar.game.level.LevelHandler; public class Small extends Projectile{ - public static final int FIRE_RATE = 7; + public static final int FIRE_RATE = 10; public Small(LevelHandler level, int x, int y, double dir) { super(level, x, y, dir); @@ -16,6 +17,12 @@ public Small(LevelHandler level, int x, int y, double dir) { nx = speed * Math.cos(angle); ny = speed * Math.sin(angle); + + //smallSound.setVolume(-15); + + AudioEffect smallSound; + smallSound = new AudioEffect("/sfx/smallProjectile.wav"); + smallSound.play(); } public void tick() { diff --git a/src/com/redomar/game/menu/Menu.java b/src/com/redomar/game/menu/Menu.java index d0ac16d..5854038 100644 --- a/src/com/redomar/game/menu/Menu.java +++ b/src/com/redomar/game/menu/Menu.java @@ -50,7 +50,7 @@ public static void play() { splash.requestFocus(); splash.splashOn(); splash.setProgress(10, "Initializing SFX"); - Player.setShootSound( new AudioEffect("/sfx/smallProjectile.wav")); + splash.setProgress(30, "Loading Music"); Game.setBackgroundMusic(new AudioHandler("/music/Towards The End.mp3")); splash.setProgress(40, "Setting Volume"); diff --git a/test/com/redomar/game/audio/AudioEffectTest.java b/test/com/redomar/game/audio/AudioEffectTest.java new file mode 100644 index 0000000..19621a2 --- /dev/null +++ b/test/com/redomar/game/audio/AudioEffectTest.java @@ -0,0 +1,28 @@ +package com.redomar.game.audio; + +import org.junit.Test; + +import java.io.File; + +import static org.junit.Assert.*; + +/** + * Created by Mohamed on 28/08/2016. + * This file tests the com.redomar.game.audio class + */ +public class AudioEffectTest { + + @Test + public void playSoundEffectAndSetVolume() { + AudioHandler sound = new AudioHandler("/sfx/smallProjectile.wav"); + sound.setVolume(-15); + sound.play(); + } + + @Test + public void sfxFileExists() throws Exception { + File sfx = new File("res/sfx/smallProjectile.wav"); + assertTrue(sfx.exists()); + } + +} \ No newline at end of file diff --git a/test/com/redomar/game/audio/AudioHandlerTest.java b/test/com/redomar/game/audio/AudioHandlerTest.java new file mode 100644 index 0000000..a942818 --- /dev/null +++ b/test/com/redomar/game/audio/AudioHandlerTest.java @@ -0,0 +1,22 @@ +package com.redomar.game.audio; + +import org.junit.Before; +import org.junit.Test; + +import java.io.File; + +import static org.junit.Assert.*; + +/** + * Created by Mohamed on 28/08/2016. + * This file tests the com.redomar.game.audio.AudioHandler class + */ +public class AudioHandlerTest { + + @Test + public void bgMusicExists() throws Exception { + File sfx = new File("res/music/Towards The End.mp3"); + assertTrue(sfx.exists()); + } + +} \ No newline at end of file From 10aa90714cef7b1a2ed908a1c9704c581fc131d9 Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 22:01:13 +0100 Subject: [PATCH 09/10] Alpha 1.8.3 - New Audio Manager --- src/com/redomar/game/Game.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/redomar/game/Game.java b/src/com/redomar/game/Game.java index a3bcf80..fce768f 100644 --- a/src/com/redomar/game/Game.java +++ b/src/com/redomar/game/Game.java @@ -24,7 +24,7 @@ public class Game extends Canvas implements Runnable { // Setting the size and name of the frame/canvas private static final long serialVersionUID = 1L; - private static final String game_Version = "v1.8.2 Alpha"; + private static final String game_Version = "v1.8.3 Alpha"; private static final int WIDTH = 160; private static final int HEIGHT = (WIDTH / 3 * 2); private static final int SCALE = 3; @@ -74,7 +74,7 @@ public class Game extends Canvas implements Runnable { /** * @author Redomar - * @version Alpha 1.8.2 + * @version Alpha 1.8.3 */ public Game() { context = InputContext.getInstance(); From 9664b4aa2da8ff6ff49ec5c82d390faed04d8beb Mon Sep 17 00:00:00 2001 From: Mohamed Omar Date: Sun, 28 Aug 2016 22:08:57 +0100 Subject: [PATCH 10/10] removed a test task --- test/com/redomar/game/audio/AudioEffectTest.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/com/redomar/game/audio/AudioEffectTest.java b/test/com/redomar/game/audio/AudioEffectTest.java index 19621a2..0c621ff 100644 --- a/test/com/redomar/game/audio/AudioEffectTest.java +++ b/test/com/redomar/game/audio/AudioEffectTest.java @@ -12,13 +12,6 @@ */ public class AudioEffectTest { - @Test - public void playSoundEffectAndSetVolume() { - AudioHandler sound = new AudioHandler("/sfx/smallProjectile.wav"); - sound.setVolume(-15); - sound.play(); - } - @Test public void sfxFileExists() throws Exception { File sfx = new File("res/sfx/smallProjectile.wav");