Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,28 @@
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
],
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#ab307e",
"activityBar.background": "#ab307e",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#25320e",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#ab307e",
"statusBar.background": "#832561",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#ab307e",
"statusBarItem.remoteBackground": "#832561",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#832561",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#83256199",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#832561",
"cSpell.words": [
"classpath"
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 火車ㄅㄨㄅㄨ, KYLiN

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file modified README.md
Binary file not shown.
5 changes: 5 additions & 0 deletions bin/GUI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# GUI

---

Here is put some thing for display
Binary file removed bin/Inputs/MouseInputs.class
Binary file not shown.
Binary file added bin/base/BaseGameConstant.class
Binary file not shown.
5 changes: 5 additions & 0 deletions bin/base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# base

---

here is put some base class function
Binary file added bin/base/loader/BaseFileNameFormatter$1.class
Binary file not shown.
Binary file added bin/base/loader/BaseFileNameFormatter.class
Binary file not shown.
Binary file added bin/base/loader/BaseLoader.class
Binary file not shown.
Binary file added bin/base/loader/FileNameType.class
Binary file not shown.
Binary file modified bin/entities/Entity.class
Binary file not shown.
Binary file modified bin/entities/Methods.class
Binary file not shown.
Binary file modified bin/entities/Player.class
Binary file not shown.
Binary file modified bin/levels/LevelManager.class
Binary file not shown.
5 changes: 5 additions & 0 deletions bin/logic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# logic

---

here is put some game logic function
Binary file not shown.
Binary file added bin/logic/input/MouseInputs.class
Binary file not shown.
Binary file modified bin/main/Game.class
Binary file not shown.
Binary file modified bin/main/GamePanel.class
Binary file not shown.
Binary file modified bin/main/MainClass.class
Binary file not shown.
Binary file modified bin/main/Online.class
Binary file not shown.
Binary file removed bin/main/Translater.class
Binary file not shown.
Binary file added bin/main/Translator.class
Binary file not shown.
Binary file modified bin/utilz/Constants$PlayerConstants.class
Binary file not shown.
Binary file modified bin/utilz/LoadSave.class
Binary file not shown.
5 changes: 5 additions & 0 deletions src/GUI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# GUI

---

Here is put some thing for display
61 changes: 0 additions & 61 deletions src/Inputs/KeyboardInputs.java

This file was deleted.

14 changes: 14 additions & 0 deletions src/base/BaseGameConstant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package base;

/**
** It's a class that contains constants that are used in the game
*/
public class BaseGameConstant {
public final static int TILES_DEFAULT_SIZE = 32;
public final static float SCALE = 2f;
public final static int TILES_IN_WIDTH = 26;
public final static int TILES_IN_HEIGHT = 14;
public final static int TILES_SIZE = (int) (TILES_DEFAULT_SIZE * SCALE);
public final static int GAME_WIDTH = TILES_SIZE * TILES_IN_WIDTH;
public final static int GAME_HEIGHT = TILES_SIZE * TILES_IN_HEIGHT;
}
5 changes: 5 additions & 0 deletions src/base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# base

---

here is put some base class function
38 changes: 38 additions & 0 deletions src/base/loader/BaseFileNameFormatter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package base.loader;

import java.util.EnumMap;

// How to use
/*
* String test = "test";
* System.out.println(BaseFileNameFormatter.of(test, FileNameType.IMAGE));
* >> test.png
*/

/*
* add type to FileNameType enum class
* and add of method in here to return a file name
*/

public class BaseFileNameFormatter {
public static EnumMap<FileNameType, String> enumMap = new EnumMap<>(FileNameType.class) {
{
put(FileNameType.IMAGE, ".png");
put(FileNameType.TEXT, ".txt");
}
};

/**
* It takes a file name and a file type and returns a string that is the file
* name with the file type
* extension appended to it
*
* @param fileName The name of the file
* @param type FileNameType
* @return The file name and the file extension.
*/
public static String of(String fileName, FileNameType type) {
return String.format("%s%s", fileName, enumMap.get(type));
}

}
60 changes: 60 additions & 0 deletions src/base/loader/BaseLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package base.loader;

import java.io.IOException;
import java.io.InputStream;

import javax.imageio.ImageIO;

import java.awt.image.BufferedImage;

// this class is a base class for loading different file or image
public class BaseLoader {

/**
* It returns an InputStream for the file specified by the fileName parameter
*
* @param obj The object that is calling the method.
* @param fileName The name of the file to load.
* @return The InputStream of the file.
*/
public static InputStream loadFile(Object obj, String fileName) {
return obj.getClass().getResourceAsStream(fileName);
}

/**
* Load a file from the classpath.
*
* @param cls The class that is calling the method.
* @param fileName The name of the file to load.
* @return An InputStream object.
*/
public static <T> InputStream loadFile(Class<T> cls, String fileName) {
return cls.getResourceAsStream(fileName);
}

/**
* Convert the cover image to a BufferedImage.
*
* @param inputStream The input stream of the image file.
* @return A BufferedImage object.
*/
public static BufferedImage coverToImage(InputStream inputStream) throws IOException {
return ImageIO.read(inputStream);
}

/**
* "Loads an image from a file and returns it as a BufferedImage."
*
* The first line of the function is the function header. It tells us the
* function's name, the type of
* data it returns, and the type of data it takes as input
*
* @param cls The class that the file is in.
* @param fileName The name of the file to load.
* @return A BufferedImage object.
*/
public static <T> BufferedImage loadImage(Class<T> cls, String fileName) throws IOException {
return coverToImage(loadFile(cls, fileName));
}

}
6 changes: 6 additions & 0 deletions src/base/loader/FileNameType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package base.loader;

// Creating an enum.
public enum FileNameType {
IMAGE, TEXT
}
9 changes: 8 additions & 1 deletion src/entities/Entity.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package entities;

import base.loader.BaseFileNameFormatter;
import base.loader.FileNameType;

public abstract class Entity {
protected float x, y;
public static final String PLAYER_MAIN_CHARACTER = "../res/mainCharacter/";

public Entity(float x, float y){
public static String imageName(String fileName) {
return BaseFileNameFormatter.of(Entity.PLAYER_MAIN_CHARACTER + fileName, FileNameType.IMAGE);
}

public Entity(float x, float y) {
this.x = x;
this.y = y;
}
Expand Down
8 changes: 3 additions & 5 deletions src/entities/Methods.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package entities;

public abstract class Methods extends Entity{

public abstract class Methods extends Entity {

public Methods(float x, float y){
public Methods(float x, float y) {
super(x, y);
}

public void importImag(){
public void importImage() {

}
}

Loading