Skip to content
Snippets Groups Projects
Commit 6919d2af authored by zlatax's avatar zlatax
Browse files

add project files and specs

parent 77da932a
Branches
No related tags found
No related merge requests found
.DS_Store 0 → 100644
File added
......@@ -21,3 +21,6 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# media files
*.mp4
/target
/.idea
*.iml
<?xml version="1.0" encoding="UTF-8"?>
<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>au.edu.unimelb.cis</groupId>
<artifactId>bagel</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<sourceDirectory>src/</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>io.github.eleanor-em</groupId>
<artifactId>bagel</artifactId>
<version>1.9.3</version>
</dependency>
</dependencies>
</project>
bagel-starter-pack/res/bagel.png

659 KiB

bagel-starter-pack/res/ball.png

2.07 KiB

File deleted
bagel-starter-pack/res/house.png

8.49 KiB

bagel-starter-pack/res/player.png

2.61 KiB

bagel-starter-pack/res/smiley.png

5.95 KiB

import bagel.*;
import java.util.Random;
/**
* An example Bagel game.
*
* @author Eleanor McMurtry
*/
public class BagelTest extends AbstractGame {
private Image smiley;
private Image bagel;
private double x = 100;
private double y = 100;
public BagelTest() {
super(800, 600, "Hello World");
bagel = new Image("res/bagel.png");
smiley = new Image("res/smiley.png");
}
/**
* The entry point for the program.
*/
public static void main(String[] args) {
BagelTest game = new BagelTest();
game.run();
}
/**
* Performs a state update. This simple example shows an image that can be controlled with the arrow keys, and
* allows the game to exit when the escape key is pressed.
*/
@Override
public void update(Input input) {
double speed = 0.5;
if (input.isDown(Keys.LEFT)) {
x -= speed;
}
if (input.isDown(Keys.RIGHT)) {
x += speed;
}
if (input.isDown(Keys.UP)) {
y -= speed;
}
if (input.isDown(Keys.DOWN)) {
y += speed;
}
if (input.wasPressed(Keys.ESCAPE)) {
Window.close();
}
bagel.draw(Window.getWidth() / 2.0, Window.getHeight() / 2.0);
smiley.draw(x, y);
}
}
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment