sem24 / java-2d-medieval-rpg Goto Github PK
View Code? Open in Web Editor NEWJava 2D Medieval RPG ๐ก๏ธ
License: MIT License
Java 2D Medieval RPG ๐ก๏ธ
License: MIT License
Make a map appear as you progress through it
Make a random chance of another generation of the dungeon (draw several options) and put 50% chance
Draw one large map, which is divided into several small locations where you can teleport to without changing the map
On the main map, make a bay and a ship, where, having paid, you are transported to another island on the same map
Add a mini game where you have to play the music correctly (by stepping on it) and then the door will open. You can listen by pressing the button.
Add a puzzle where you will fall if you step on it wrong(as in undertale)
NEW OPTION
Instead of video, create the class that will have several images (so it will be like slideshow) with bg music and
draw that images(create them in photoshop/sony vegas) to show the "lore" of game. Also use transactional method to change the images like "fade out".
OLD OPTION
Use long enter press to skip the video.
Tips
Tips
Tips
ChatGPT Tips:
To display a video as the first screen of your Java Swing application, you can use a JFrame to create the main window and a JLabel to display the video. You can then use a library like vlcj or JMF to play the video. Here's an example of how you can achieve this:
First, make sure you have the necessary libraries in your project. You can add them as dependencies using your preferred build tool (e.g., Maven or Gradle). For example, if you're using Maven, add the following dependencies to your pom.xml file:
Create a new class, let's say VideoPlayer, that extends JFrame and contains a JLabel for displaying the video. Add the necessary imports:
java
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayerComponent;
import javax.swing.;
import java.awt.;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class VideoPlayer extends JFrame {
private final EmbeddedMediaPlayer mediaPlayer;
public VideoPlayer(String videoPath) {
// Set up the main window
setTitle("Video Player");
setSize(800, 600);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create the media player component
EmbeddedMediaPlayerComponent mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
mediaPlayer = mediaPlayerComponent.getMediaPlayer();
// Add the media player component to the frame
Container contentPane = getContentPane();
contentPane.add(mediaPlayerComponent, BorderLayout.CENTER);
// Play the video
mediaPlayer.playMedia(videoPath);
// Add a window listener to stop the player and close the application when the window is closed
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
mediaPlayer.stop();
mediaPlayer.release();
super.windowClosing(e);
}
});
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
// Replace "path/to/video.mp4" with the actual path to your video file
VideoPlayer player = new VideoPlayer("path/to/video.mp4");
player.setVisible(true);
});
}
}
Replace "path/to/video.mp4" with the actual path to your video file in the main method.
Compile and run the application. The video should start playing automatically, and the application window will close when the video finishes or when the user closes the window.
Make sure to replace "path/to/video.mp4" with the actual path to your video file. Also, ensure that you have the necessary codecs and dependencies installed for video playback to work correctly.
If you prefer not to use any external libraries, you can use the built-in support for playing videos in Java Swing using the JEditorPane class. Here's an example of how you can achieve this:
java
import javax.swing.;
import java.awt.;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
public class VideoPlayer extends JFrame {
private JEditorPane editorPane;
public VideoPlayer(String videoPath) {
// Set up the main window
setTitle("Video Player");
setSize(800, 600);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create the editor pane
editorPane = new JEditorPane();
editorPane.setEditable(false);
editorPane.setContentType("text/html");
// Load the video HTML into the editor pane
try {
File videoFile = new File(videoPath);
String videoURL = videoFile.toURI().toURL().toString();
editorPane.setText("<html><body><video src='" + videoURL + "' autoplay></video></body></html>");
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// Add the editor pane to the frame
Container contentPane = getContentPane();
contentPane.add(new JScrollPane(editorPane), BorderLayout.CENTER);
// Add a window listener to close the application when the window is closed
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
}
});
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
// Replace "path/to/video.mp4" with the actual path to your video file
VideoPlayer player = new VideoPlayer("path/to/video.mp4");
player.setVisible(true);
});
}
}
In this example, the JEditorPane is used to display an HTML document that contains an embedded
Make sure to replace "path/to/video.mp4" with the actual path to your video file.
Compile and run the application, and the video should start playing automatically when the application opens.
Fix when, after loading a save on another map, music turns on for the first map
(Most likely, the appearance and the map will not save for a simple)
Make smarter AI behavior while walking, possibly confer with GPT chat
Use this links as an examples for main music:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.