Skip to content
Snippets Groups Projects
Commit 77da932a authored by zlatax's avatar zlatax
Browse files

Add bagel files

parent 57b07435
Branches
No related tags found
No related merge requests found
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/SWEN20003_a1.iml" filepath="$PROJECT_DIR$/.idea/SWEN20003_a1.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
/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 added
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);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment