Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

3
Java/Platformer/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

6
Java/Platformer/.idea/discord.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
</component>
</project>

6
Java/Platformer/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
Java/Platformer/.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Platformer.iml" filepath="$PROJECT_DIR$/Platformer.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,11 @@
<?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$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -0,0 +1,78 @@
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Frame extends JFrame implements ActionListener {
public static Frame frame;
private JButton close;
private JButton settings;
private JButton info;
private JButton end;
public static void main(String[] args) {
frame = new Frame("Menü");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 400);
frame.setResizable(false);
frame.setLayout(null);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public Frame(String title) {
super(title);
close = new JButton("Spiel starten");
close.setBounds(120, 40, 160, 40);
close.addActionListener(this);
add(close);
settings = new JButton("Einstellungen");
settings.setBounds(120, 120, 160, 40);
settings.addActionListener(this);
add(settings);
info = new JButton("Credits");
info.setBounds(120, 200, 160, 40);
info.addActionListener(this);
add(info);
end = new JButton("Spiel beenden");
end.setBounds(120, 280, 160, 40);
end.addActionListener(this);
add(end);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(close)) {
game();
}
if (e.getSource().equals(settings)) {
selection();
}
if (e.getSource().equals(info)) {
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "Programmiert von deiner Mum", "Information", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
}
if (e.getSource().equals(end)) {
System.exit(0);
}
}
public static void game() {
frame.setVisible(false);
JFrame game = new JFrame();
game.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
game.setSize(650, 350);
game.setLocationRelativeTo(null);
game.setResizable(false);
game.setVisible(true);
game.add(new Gui());
}
public static void selection() {
}
}

View File

@@ -0,0 +1,47 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class Gui extends JPanel implements ActionListener {
Image img;
int key = 0;
int move = 0;
public Gui() {
setFocusable(true);
ImageIcon u = new ImageIcon("rsc/background.jpg");
img = u.getImage();
}
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2 = (Graphics2D) g;
g2.drawImage(img, 0, 0, null);
}
private class AL extends KeyAdapter {
@Override
public void keyPressed(KeyEvent e) {
key = e.getKeyCode();
if (key == KeyEvent.VK_A) move = +1;
if (key == KeyEvent.VK_D) move = -1;
}
@Override
public void keyReleased(KeyEvent e) {
if (key != KeyEvent.VK_A && key != KeyEvent.VK_D) return;
move = 0;
key = -1;
}
}
@Override
public void actionPerformed(ActionEvent e) {
requestFocus();
}
}