Skip to content

Commit d5ec124

Browse files
author
PastThePixels
committed
Change sound effects and rename to Espresso
1 parent dfd55d9 commit d5ec124

File tree

12 files changed

+32
-21
lines changed

12 files changed

+32
-21
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# JyGame-Example
1+
# Espresso-Example
22
![](./screenshot.png)
3-
An example game utilizing the [JyGame](https://github.com/pastthepixels/JyGame) library.
3+
An example game utilizing the [Espresso](https://github.com/pastthepixels/Espresso) library.
44

55
## How do I run it?
66
1. Go to the Releases tab and download the .jar
77
2. Run `java -jar jygame_example-1.0-full.jar`
88

99
## How do I compile it?
10-
1. Install JyGame to your computer either via something something GitHub Packages or following the instructions in its README
10+
1. Install Espresso to your computer either via something something GitHub Packages or following the instructions in its README
1111
2. Clone this repository
1212
3. Run `mvn clean compile assembly:single`

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>io.github.pastthepixels.jygame_example</groupId>
7+
<groupId>io.github.espressoengine.example</groupId>
88
<artifactId>jygame_example</artifactId>
99
<version>1.0</version>
1010

11-
<name>JyGame Example</name>
12-
<url>https://github.com/pastthepixels/JyGame-Example</url>
11+
<name>Espresso Example</name>
12+
<url>https://github.com/EspressoEngine/Example</url>
1313

1414
<properties>
1515
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -33,15 +33,15 @@
3333
<artifactId>exec-maven-plugin</artifactId>
3434
<version>1.4.0</version>
3535
<configuration>
36-
<mainClass>io.github.pastthepixels.jygame_example.App</mainClass>
36+
<mainClass>io.github.espressoengine.example.App</mainClass>
3737
</configuration>
3838
</plugin>
3939
<plugin>
4040
<artifactId>maven-assembly-plugin</artifactId>
4141
<configuration>
4242
<archive>
4343
<manifest>
44-
<mainClass>io.github.pastthepixels.jygame_example.App</mainClass>
44+
<mainClass>io.github.espressoengine.example.App</mainClass>
4545
</manifest>
4646
</archive>
4747
<descriptorRefs>

src/main/java/io/github/pastthepixels/jygame_example/App.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

33
public class App {
44
public static void main(String[] args) {

src/main/java/io/github/pastthepixels/jygame_example/Enemy.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/Enemy.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

33
import io.github.espressoengine.physics.RigidBody;
4+
import io.github.espressoengine.sound.Sound;
45

56
public class Enemy extends Entity {
67

@@ -15,6 +16,8 @@ public class Enemy extends Entity {
1516

1617
int frames_to_fire = 100; // Frames until a laser is fired.
1718

19+
public Sound laser_sound = new Sound("src/main/resources/laser-fire.wav");
20+
1821
@Override
1922
public void updateGeometry() {
2023
this.geometry = (new GeometryBank()).createPolygon((new GeometryBank()).ship_geometry, this._enginePosition);
@@ -59,7 +62,7 @@ public void move() {
5962
}
6063

6164
public void fire() {
62-
Laser laser = new Laser(this, this.body, this.game);
65+
Laser laser = new Laser(this, this.body, this.game, this.laser_sound);
6366
laser.mesh.fillColor = fillColor;
6467
game.lasers.add(laser);
6568
game.root.add(laser.mesh);

src/main/java/io/github/pastthepixels/jygame_example/Entity.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/Entity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

33
import io.github.espressoengine.object.Mesh2D;
44

src/main/java/io/github/pastthepixels/jygame_example/Explosion.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/Explosion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

33
import java.awt.Color;
44

src/main/java/io/github/pastthepixels/jygame_example/Game.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/Game.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

33
import java.awt.Color;
44

@@ -20,7 +20,7 @@ public class Game {
2020
int laser_fire_interval = 16; // Measured in frames.
2121

2222
// Class instances otherwise ungrouped
23-
Scene root = new Scene(new Window(DIMENSIONS, "JyGame Example")) {
23+
Scene root = new Scene(new Window(DIMENSIONS, "Espresso Example")) {
2424
@Override
2525
public void process(double delta) {
2626
updateLaserMovement();
@@ -57,6 +57,7 @@ public void init() {
5757

5858
public void initMusic() {
5959
Sound music = new Sound("src/main/resources/soundtrack.wav"); // <-- We have to have wav files for some reason
60+
music.setLoop(true);
6061
music.play();
6162
}
6263

@@ -125,7 +126,7 @@ public void onDie() {
125126
public void checkLaserInput() {
126127
if(keys.isKeyPressed(32) == true) {
127128
if(frames_since_last_fire == 0) { // Fires a laser when the counter is at 0 so that tapping the spacebar to fire lasers works.
128-
Laser laser = new Laser(player, player.body, this);
129+
Laser laser = new Laser(player, player.body, this, player.laser_sound);
129130
laser.mesh.fillColor = player.fillColor;
130131
laser.mesh.strokeColor = player.strokeColor;
131132
laser.mesh.strokeWidth = player.strokeWidth;

src/main/java/io/github/pastthepixels/jygame_example/GeometryBank.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/GeometryBank.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

33
import io.github.espressoengine.Vector2;
44

src/main/java/io/github/pastthepixels/jygame_example/Laser.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/Laser.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

3+
import io.github.espressoengine.sound.Sound;
34
import io.github.espressoengine.object.*;
45
import io.github.espressoengine.physics.RigidBody;
56

@@ -16,7 +17,8 @@ public class Laser {
1617

1718
double damage = 5;
1819

19-
public Laser(Mesh2D sender, RigidBody senderBody, Game game) {
20+
21+
public Laser(Mesh2D sender, RigidBody senderBody, Game game, Sound preloaded_laser_sound) {
2022
this.game = game;
2123
mesh.zIndex = -1;
2224
mesh.fillColor = Color.RED;
@@ -36,6 +38,8 @@ public void onBodyEntered(RigidBody body) { // <-- importan (sic)
3638
body.disabled = true;
3739
body.mass = 0;
3840
game.physics.add(body);
41+
// Commented right now because Espresso can't load a sound once and then play it repeatedly so that each repeat can overlap one another
42+
// preloaded_laser_sound.play();
3943
}
4044

4145
public void remove() {

src/main/java/io/github/pastthepixels/jygame_example/Player.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/Player.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

33
import io.github.espressoengine.physics.RigidBody;
44

5+
import io.github.espressoengine.sound.Sound;
56
import java.awt.Color;
67
import java.util.concurrent.Executors;
78

@@ -20,6 +21,8 @@ public class Player extends Entity {
2021
double drag = 0.06; // Pixels/refresh^2
2122
double max_speed = 4; // Pixels/refresh
2223

24+
public Sound laser_sound = new Sound("src/main/resources/laser-fire.wav");
25+
2326
public Player(Game game) {
2427
this.game = game;
2528
body.disabled = true;

src/main/java/io/github/pastthepixels/jygame_example/ProgressBar.java renamed to src/main/java/io/github/espressoengine/example/espresso_example/ProgressBar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.pastthepixels.jygame_example;
1+
package io.github.espressoengine.example;
22

33
import io.github.espressoengine.Scene;
44
import io.github.espressoengine.Vector2;

src/main/resources/laser-fire.wav

60.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)