Compare commits

...

31 Commits

Author SHA1 Message Date
Jonathan Hager 1cf1db0c6d
README updated
3 years ago
JanEhehalt b823edd931 movement and viewports kinda fixed, ready for playstore update
4 years ago
Jonathan Hager ee66afd2c4 README and LICENSE ported from anchient trc repo
5 years ago
Jan Ehehalt 46aa3a0c71 lol
6 years ago
Jan Ehehalt dd1f642535 desktop
6 years ago
Jonathan Hager 0effd69745 lol
6 years ago
Jan Ehehalt 5b8424ab82 t pushMerge branch 'master' of https://gitlab.com/JonathanHager/trc-mobile
6 years ago
Jan Ehehalt 143b8ec74c lol
6 years ago
Jonathan Hager 199099bb1f Lol
6 years ago
Jonathan Hager 0ecd97b8ec lol
6 years ago
Jan Ehehalt 7456a0afb6 Lol
6 years ago
Jan Ehehalt 582f8c6533 lllll
6 years ago
Jan Ehehalt 4e745511da lol
6 years ago
Jan Ehehalt d1beb23cd4 funktioniert eigentlich noch gar net lol
6 years ago
Jonathan Hager d31899d765 lol
6 years ago
Jonathan Hager 622938e9e2 Merge branch 'lol'
6 years ago
Jonathan Hager 7fe1fdd47a Lol
6 years ago
GammelJan b851e96f14 Lol
6 years ago
Jonathan Hager fbc3a82c23 Lol
6 years ago
GammelJan 7a82ca3760 lol
6 years ago
Jonathan Hager d21b7d9d76 Merge branch 'lol'
6 years ago
GammelJan b696eeadef lol
6 years ago
Jonathan Hager 2b8456d24e lol
6 years ago
Jonathan Hager 2db195a9aa Lol
6 years ago
Jonathan Hager 76f4876aaf lol
6 years ago
GammelJan 831b98a9e1 lol
6 years ago
GammelJan dec3386774 lol
6 years ago
GammelJan b329934dfd Lol
6 years ago
Jan Ehehalt 2acc4c4b14 lol
6 years ago
Jan Ehehalt 6e66f9edd3 lol
6 years ago
GammelJan 5eb77f5074 lol EHRE
6 years ago

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Jonathan Hager
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.

@ -0,0 +1,64 @@
**Privacy Policy**
TheRestlessStudios built the The Restless Caverns app as an Open Source app. This SERVICE is provided by TheRestlessStudios at no cost and is intended for use as is.
This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.
If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at The Restless Caverns unless otherwise defined in this Privacy Policy.
**Information Collection and Use**
Our app by itself doesn't collect any information about the user.
The app does use third party services that may collect information used to identify you.
Link to privacy policy of third party service providers used by the app
* [Google Play Services](https://www.google.com/policies/privacy/)
**Log Data**
I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.
**Cookies**
Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device's internal memory.
This Service does not use these “cookies” explicitly. However, the app may use third party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.
**Service Providers**
I may employ third-party companies and individuals due to the following reasons:
* To facilitate our Service;
* To provide the Service on our behalf;
* To perform Service-related services; or
* To assist us in analyzing how our Service is used.
I want to inform users of this Service that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.
**Security**
I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.
**Links to Other Sites**
This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.
**Childrens Privacy**
These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13\. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do necessary actions.
**Changes to This Privacy Policy**
I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page.
This policy is effective as of 2020-07-03
**Contact Us**
If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me at therestlesscaverns@gmail.com.
This privacy policy page was created at [privacypolicytemplate.net](https://privacypolicytemplate.net) and modified/generated by [App Privacy Policy Generator](https://app-privacy-policy-generator.firebaseapp.com/)

@ -0,0 +1,65 @@
# The Restless Caverns - The best dungeon crawler of all time
[[_TOC_]]
## General Information
"The Restless Caverns" is the best dungeon crawler the world has ever seen.
The project was created by @GammelJAN and @JonathanHager
The project is still being updated, and far from finished.
The future of this game is **HUGE**.
Engine: libGDX - https://libgdx.badlogicgames.com/
<img src="docs/general.PNG">
Credits for Entity-Sprites:
Calciumtrice
Twitter: https://twitter.com/calciumtrice
OpenGameArt: https://opengameart.org/users/calciumtrice
## Installation
#### newest Build:
Download executable -jar here:
https://send.firefox.com/download/04dde021f2f23c45/#HErUzC8M5guBWYE-wRZLgg
doesn't work anymore lollololol this is bad news :(
## Known Issues
## Controls
**W**: move up
**A**: move left
**S**: move down
**D**: move right
**SPACE**: Attack
**F**: pick up
**R**: equip selected item
**scroll-wheel**: change selected item
**Q**: drop selected Item
**ESC**: pause Game / resume Game
## Information about the code
### Model
### View
### Control
## Contact
Mail:
therestlesscaverns@gmail.com
GitLab:
@GammelJAN
@Jonathanhager

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

@ -1 +1,20 @@
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"android-release.apk","fullName":"release","baseName":"release"},"path":"android-release.apk","properties":{}}]
{
"version": 1,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.dungeoncrawler.control",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 1,
"versionName": "1",
"enabled": true,
"outputFile": "android-release.apk"
}
]
}

@ -11,6 +11,9 @@ public class AndroidLauncher extends AndroidApplication {
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.hideStatusBar = true;
config.numSamples = 0;
config.useImmersiveMode = true;
initialize(new Controller(), config);
}
}

@ -10,7 +10,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:4.0.0'
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -11,12 +11,18 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.maps.MapLayers;
import com.badlogic.gdx.maps.MapObjects;
import com.badlogic.gdx.maps.objects.RectangleMapObject;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.dungeoncrawler.view.*;
import com.dungeoncrawler.model.Dungeon;
import com.dungeoncrawler.model.DungeonGenerator;
@ -24,11 +30,23 @@ import com.dungeoncrawler.model.entities.*;
import com.dungeoncrawler.model.Entity;
import com.badlogic.gdx.utils.Timer;
import com.dungeoncrawler.model.ItemContainer;
import java.util.ArrayList;
public class Controller extends ApplicationAdapter implements InputProcessor{
float GAME_WORLD_WIDTH;
float GAME_WORLD_HEIGHT;
boolean shotFrame = false;
final boolean TOUCH = true;
// CAMERA
OrthographicCamera camera;
Viewport viewport;
SpriteBatch batch;
Dungeon d;
DungeonGenerator dg;
@ -75,7 +93,18 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
@Override
public void create(){
GAME_WORLD_WIDTH = 1600;
GAME_WORLD_HEIGHT = 900;
camera = null;
viewport = null;
camera = new OrthographicCamera();
camera.update();
viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera);
viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
viewport.apply();
camera.position.set(GAME_WORLD_WIDTH / 2, GAME_WORLD_HEIGHT / 2, 0);
camera.update();
checkDoor = true;
checkDie = true;
@ -116,6 +145,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
d.setCurrentRoom(d.getCurrentLevel().getRooms()[roomPosX][roomPosY]);
d.setCurrentEntities(d.getCurrentRoom().getEnemies());
d.initVisited(roomAmount);
d.updateVisited(roomPosX, roomPosY);
Gdx.input.setInputProcessor(this);
@ -126,6 +158,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
public void run() {
if(gs != null){
shotFrame = false;
if(gs.player.getAttackState() == 2){
playerAttack(d.getCurrentEntities(), d.getPlayer(), d.getPlayer().getDirection());
}
@ -147,7 +180,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(d.getPlayer().isToDelete()){
attacks = false;
}
// Attacke wird gestartet, wenn noch keine laueft
// Attack starts if none is running
if(attacks && gs.entitySprites[i].getAttackState() == 0){
gs.entitySprites[i].startAttack();
}
@ -276,7 +309,10 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(delete || d.getCurrentEntities()[i].isToDelete()){
if(d.getCurrentEntities()[i].getType()== 2){
d.getPlayer().addExp(d.getCurrentEntities()[i].getExp());
System.out.println(d.getCurrentEntities()[i].getExp());
d.getCurrentEntities()[i] = null;
gs.deleteEntitySprite(i);
}
else{
@ -302,19 +338,34 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
}
@Override
public void resize(int width, int height){
viewport.update(width, height);
camera.position.set(GAME_WORLD_WIDTH / 2, GAME_WORLD_HEIGHT / 2, 0);
}
@Override
public void render(){
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
if(end == true){
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
if(end){
if(es == null){
isPaused = true;
entityMovement.stop();
gs.end();
gs.getCamera().update();
batch.setProjectionMatrix(gs.getCamera().combined);
GAME_WORLD_WIDTH = 1600;
GAME_WORLD_HEIGHT = 900;
camera = null;
viewport = null;
camera = new OrthographicCamera();
camera.update();
viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera);
viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
viewport.apply();
camera.position.set(GAME_WORLD_WIDTH / 2, GAME_WORLD_HEIGHT / 2, 0);
camera.update();
batch.setProjectionMatrix(camera.combined);
gs = null;
hc = null;
es = new EndScreen(kills);
@ -332,7 +383,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
cs.render(batch);
}
if(ps != null){
ps.render(batch, volume, gs.getCamera());
ps.render(batch, volume, camera);
}
//PASSIERT IN GAMESCREEN
@ -357,8 +408,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
// Render methode zum rendern der einzelnen Sprites wird aufgerufen
if(gs != null){;
d.getPlayer().updateItems();
gs.render(batch, d.getPlayer(), d.getCurrentEntities(), tileX, tileY, level, roomPosX, roomPosY);
hc.updateHud(batch, d.getPlayer());
d.getPlayer().updateStats(level + 1);
gs.render(batch, d.getPlayer(), d.getCurrentEntities(), tileX, tileY, level, roomPosX, roomPosY, camera, d.getVisited(), TOUCH);
}
}
@ -527,16 +579,22 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
int roomAmount = d.getLevel()[level].getRooms().length;
roomPosX = roomAmount / 2;
roomPosY = roomAmount / 2;
d.initVisited(roomAmount);
d.updateVisited(roomPosX, roomPosY);
}
else{ // Dungeon Exit
end = true;
return;
}
}
d.updateVisited(roomPosX, roomPosY);
d.setCurrentLevel(d.getLevel()[level]);
d.setCurrentRoom(d.getCurrentLevel().getRooms()[roomPosX][roomPosY]);
d.setCurrentEntities(d.getCurrentRoom().getEnemies());
gs.generateEntitySprites(d.getCurrentEntities());
@ -602,6 +660,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
e[i].setHp(0);
gs.createDmgFont((int) p.getDmg(),(int)e[i].getxPos() + 10,(int) e[i].getyPos() + 20);
e[i].setToDelete(true);
p.addExp(e[i].getExp());
kills++;
}
else{
@ -709,7 +768,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
d.getPlayer().useItem(d.getPlayer().getInv().getSelected());
}
}
/*
if(keycode == Input.Keys.ESCAPE && !end){
if(gs != null && gs.getIsLoading() == false && isPaused == false){
stop();
@ -718,7 +777,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
resume();
}
}
*/
if(keycode == Input.Keys.LEFT){
if(mm != null){}
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
@ -754,7 +813,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(mm != null){}
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() + 1, (int) d.getPlayer().getyPos());
for(int k = 5; k < d.getCurrentEntities().length; k++){
if(d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1){
d.getCurrentEntities()[k] = lol;
@ -901,13 +960,25 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button)
{
//if(button == Input.Buttons.LEFT){
if(gs == null){
switch(click(screenX, screenY)){
case -1: // -1: nothing hit -- 0: go ingame -- 1: EXIT game -- 2: goto settings -- 3: goto controls -- 4: goto MainMenuScreen -- 9: volume down -- 10: volume up -- 11: restart game
break;
case 0:
mm.cleanUp();
mm = null;
GAME_WORLD_WIDTH = 700;
GAME_WORLD_HEIGHT = 394;
camera = null;
viewport = null;
camera = new OrthographicCamera();
camera.update();
viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera);
viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
viewport.apply();
camera.position.set(GAME_WORLD_WIDTH / 2 - 170, GAME_WORLD_HEIGHT / 2 + 20, 0);
camera.update();
batch.setProjectionMatrix(camera.combined);
gs = new GameScreen(d, volume);
gs.generateEntitySprites(d.getCurrentEntities());
hc = new HudContainer();
@ -917,12 +988,36 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
case 1:
mm.cleanUp();
mm = null;
GAME_WORLD_WIDTH = 700;
GAME_WORLD_HEIGHT = 394;
camera = null;
viewport = null;
camera = new OrthographicCamera();
camera.update();
viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera);
viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
viewport.apply();
camera.position.set(GAME_WORLD_WIDTH / 2 - 170, GAME_WORLD_HEIGHT / 2 + 20, 0);
camera.update();
batch.setProjectionMatrix(camera.combined);
gs = new GameScreen(d, volume);
break;
case 2:
mm.hide();
cs = null;
GAME_WORLD_WIDTH = 1600;
GAME_WORLD_HEIGHT = 900;
camera = null;
viewport = null;
camera = new OrthographicCamera();
camera.update();
viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera);
viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
viewport.apply();
camera.position.set(GAME_WORLD_WIDTH / 2, GAME_WORLD_HEIGHT / 2, 0);
camera.update();
batch.setProjectionMatrix(camera.combined);
ss = new SettingsScreen();
break;
@ -974,34 +1069,193 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
}
break;
case 11:
create();
break;
}
if(gs == null){
mm.cleanUp();
mm = null;
gs = new GameScreen(d, volume);
gs.generateEntitySprites(d.getCurrentEntities());
hc = new HudContainer();
gs.startLoadingScreen();
}
else if(gs != null && gs.getIsLoading() == false) {
if (screenX < 0.25 * Gdx.graphics.getWidth()) {
d.getPlayer().setMovementX(-d.getPlayer().getMovementSpeed());
}
else if (screenX > 0.75 * Gdx.graphics.getWidth()) {
d.getPlayer().setMovementX(d.getPlayer().getMovementSpeed());
}
if (screenX > 0.25 * Gdx.graphics.getWidth() && screenX < 0.75 * Gdx.graphics.getWidth() && screenY > 0.5 * Gdx.graphics.getHeight()) {
d.getPlayer().setMovementY(d.getPlayer().getMovementSpeed());
}
else if(screenX > 0.25 * Gdx.graphics.getWidth() && screenX < 0.75 * Gdx.graphics.getWidth() && screenY < 0.5 * Gdx.graphics.getHeight()){
d.getPlayer().setMovementY(-d.getPlayer().getMovementSpeed());
}
}
}
//}
if(gs != null){
if(!d.getPlayer().isToDelete()) {
ArrayList<Integer> clicked = gs.click(screenX,screenY, viewport);
d.getPlayer().setMovementX(0);
d.getPlayer().setMovementY(0);
for (Integer i : clicked) {
switch (i) { // -1: nix, 0: left, 1: up, 2: right, 3: down, 4: attackLeft, 5: attackUp, 6: attackRight, 7: attackDown, 8: pickUp
case 0:
if(TOUCH)
d.getPlayer().setMovementX(-d.getPlayer().getMovementSpeed());
break;
case 1:
if(TOUCH)
d.getPlayer().setMovementY(d.getPlayer().getMovementSpeed());
break;
case 2:
if(TOUCH)
d.getPlayer().setMovementX(d.getPlayer().getMovementSpeed());
break;
case 3:
if(TOUCH)
d.getPlayer().setMovementY(-d.getPlayer().getMovementSpeed());
break;
case 4:
if(TOUCH)
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
shotFrame = true;
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() - 1, (int) d.getPlayer().getyPos());
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 5:
if(TOUCH)
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
shotFrame = true;
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos() + 1);
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 6:
if(TOUCH)
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
shotFrame = true;
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() + 1, (int) d.getPlayer().getyPos());
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 7:
if(TOUCH)
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
shotFrame = true;
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos() - 1);
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 8:
if(TOUCH)
// pickUp
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
if(!d.getPlayer().inventoryFull()){
ArrayList<ItemContainer> garbage = playerPickUp();
for(ItemContainer item : garbage){
d.getPlayer().getInv().addItem(item.getItem());
}
}
}
break;
case 9:
if(TOUCH)
// equip1
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
d.getPlayer().getInv().equipSlot(0);
d.getPlayer().updateItems();
}
break;
case 10:
// drop
if(TOUCH)
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
if(d.getPlayer().getInv().getItem(d.getPlayer().getInv().getSelected()) != null){
d.getCurrentRoom().spawnItem((int)d.getPlayer().getxPos(), (int)d.getPlayer().getyPos(), d.getPlayer().getInv().getItem(d.getPlayer().getInv().getSelected()));
gs.getM().getMaps()[level][roomPosX][roomPosY].addItem(48, 48,(int)d.getPlayer().getxPos(), (int)d.getPlayer().getyPos(), d.getPlayer().getInv().getItem(d.getPlayer().getInv().getSelected()));
d.getPlayer().getInv().dropItem();
d.getPlayer().updateItems();
}
}
break;
case 11:
// equip2
if(TOUCH)
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
d.getPlayer().getInv().equipSlot(1);
d.getPlayer().updateItems();
}
break;
case 12:
// use
if(TOUCH)
if(gs != null && gs.getIsLoading() == false && !d.getPlayer().isToDelete()){
d.getPlayer().useItem(d.getPlayer().getInv().getSelected());
}
break;
case 20:
if(!d.getPlayer().isToDelete()){
d.getPlayer().getInv().setSelected(0);
}
break;
case 21:
if(!d.getPlayer().isToDelete()){
d.getPlayer().getInv().setSelected(1);
}
break;
case 22:
if(!d.getPlayer().isToDelete()){
d.getPlayer().getInv().setSelected(2);
}
break;
case 23:
if(!d.getPlayer().isToDelete()){
d.getPlayer().getInv().setSelected(3);
}
break;
case 24:
if(!d.getPlayer().isToDelete()){
d.getPlayer().getInv().setSelected(4);
}
break;
case 25:
if(!d.getPlayer().isToDelete()){
d.getPlayer().getInv().setSelected(5);
}
break;
case 26:
if(!d.getPlayer().isToDelete()){
d.getPlayer().getInv().setSelected(6);
}
break;
case 27:
if(!d.getPlayer().isToDelete()){
d.getPlayer().getInv().setSelected(7);
}
break;
}
}
}
}
return true;
}
@ -1010,32 +1264,209 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
return es.click(x, y);
}
if(ps != null){
return ps.click(x,y);
return ps.click(x,y, viewport);
}
if(mm != null && mm.getHidden() == false){
return mm.click(x, y);
if(mm != null && !mm.getHidden()){
return mm.click(x, y, viewport);
}
if(ss != null){
return ss.click(x, y);
return ss.click(x, y, viewport);
}
if(cs != null){
return cs.click(x, y);
}
if(gs != null && isPaused == true){
}
return -1;
}
@Override
public boolean touchUp(int i, int i1, int i2, int i3) {
return false;
public boolean touchUp(int screenX, int screenY, int i2, int i3) {
if(gs != null){
ArrayList<Integer> e = gs.click(screenX,screenY, viewport);
Vector2 mov = new Vector2(d.getPlayer().getMovementX(), d.getPlayer().getMovementY());
if(e.contains(0) && !shotFrame){
d.getPlayer().setMovementX(0);
}
if(e.contains(1) && !shotFrame){
d.getPlayer().setMovementY(0);
}
if(e.contains(2) && !shotFrame){
d.getPlayer().setMovementX(0);
}
if(e.contains(3) && !shotFrame){
d.getPlayer().setMovementY(0);
}
if(shotFrame){
d.getPlayer().setMovementX(mov.x);
d.getPlayer().setMovementY(mov.y);
}
/*
for (Integer i : gs.click(screenX,screenY)) {
switch (i) { // -1: nix, 0: left, 1: up, 2: right, 3: down, 4: attackLeft, 5: attackUp, 6: attackRight, 7: attackDown
case 0:
d.getPlayer().setMovementX(-d.getPlayer().getMovementSpeed());
break;
case 1:
d.getPlayer().setMovementY(d.getPlayer().getMovementSpeed());
break;
case 2:
d.getPlayer().setMovementX(d.getPlayer().getMovementSpeed());
break;
case 3:
d.getPlayer().setMovementY(-d.getPlayer().getMovementSpeed());
break;
case 4:
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() - 1, (int) d.getPlayer().getyPos());
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 5:
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos() + 1);
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 6:
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() + 1, (int) d.getPlayer().getyPos());
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 7:
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos() - 1);
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
}
}
*/
}
return true;
}
@Override
public boolean touchDragged(int i, int i1, int i2) {
return false;
public boolean touchDragged(int screenX, int screenY, int i2) {
if(gs != null && TOUCH){
if(!d.getPlayer().isToDelete()) {
if(!gs.click(screenX,screenY, viewport).contains(0) && !gs.click(screenX,screenY, viewport).contains(2)) {
d.getPlayer().setMovementX(0);
}
if(!gs.click(screenX,screenY, viewport).contains(1) && !gs.click(screenX,screenY, viewport).contains(3)) {
d.getPlayer().setMovementY(0);
}
for (Integer i : gs.click(screenX,screenY, viewport)) {
switch (i) { // -1: nix, 0: left, 1: up, 2: right, 3: down, 4: attackLeft, 5: attackUp, 6: attackRight, 7: attackDown
case 0:
d.getPlayer().setMovementX(-d.getPlayer().getMovementSpeed());
break;
case 1:
d.getPlayer().setMovementY(d.getPlayer().getMovementSpeed());
break;
case 2:
d.getPlayer().setMovementX(d.getPlayer().getMovementSpeed());
break;
case 3:
d.getPlayer().setMovementY(-d.getPlayer().getMovementSpeed());
break;
case 4:
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() - 1, (int) d.getPlayer().getyPos());
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 5:
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos() + 1);
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 6:
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos() + 1, (int) d.getPlayer().getyPos());
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
case 7:
if (!gs.getIsLoading() && !d.getPlayer().isToDelete()) {
Entity lol = d.getPlayer().shoot((int) d.getPlayer().getxPos(), (int) d.getPlayer().getyPos() - 1);
for (int k = 5; k < d.getCurrentEntities().length; k++) {
if (d.getCurrentEntities()[k] == null && gs.player.getSecondaryAttackState() != 1) {
d.getCurrentEntities()[k] = lol;
gs.generateNewEntitySprite(lol, k);
gs.player.startSecondaryAttack();
break;
}
}
}
break;
}
}
}
}
return true;
}
@Override
@ -1061,13 +1492,36 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
entityMovement.stop();
gs.stop();
cs = null;
GAME_WORLD_WIDTH = 1600;
GAME_WORLD_HEIGHT = 900;
camera = null;
viewport = null;
camera = new OrthographicCamera();
camera.update();
viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera);
viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
viewport.apply();
camera.position.set(GAME_WORLD_WIDTH / 2, GAME_WORLD_HEIGHT / 2, 0);
camera.update();
ps = new PauseScreen();
}
public void resume(){
GAME_WORLD_WIDTH = 700;
GAME_WORLD_HEIGHT = 394;
camera = null;
viewport = null;
camera = new OrthographicCamera();
camera.update();
viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera);
viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
viewport.apply();
camera.position.set(GAME_WORLD_WIDTH / 2 - 170, GAME_WORLD_HEIGHT / 2 + 20, 0);
camera.update();
isPaused = false;
entityMovement.start();
gs.resume();
ps = null;
gs.startLoadingScreen();
}

@ -18,6 +18,9 @@ public class Dungeon {
private Level currentLevel;
private Room currentRoom;
private Entity[] currentEntities;
// 0: not found, 1: found, 2: visited
private int[][] isVisited;
public Dungeon(Player player){
this.level = new Level[7];
@ -27,6 +30,10 @@ public class Dungeon {
public void update(){
// TODO: Implementieren
}
public void initVisited(int amount){
isVisited = new int[amount][amount];
}
/**
* @return the level
@ -103,5 +110,53 @@ public class Dungeon {
public void setCurrentEntities(Entity[] currentEntities) {
this.currentEntities = currentEntities;
}
public int getVisited(int i, int j){
return isVisited[i][j];
}
public int[][] getVisited(){
return isVisited;
}
public void setVisited(int i, int j, int value){
isVisited[i][j] = value;
}
public void updateVisited(int roomX, int roomY){
// currentRoom is visited, therefore set to 2
isVisited[roomX][roomY] = 2;
// all neighboring rooms are now found, set to 1, if possible
// left
if(roomX > 0 && currentLevel.getRooms()[roomX - 1][roomY] != null){
if(isVisited[roomX - 1][roomY] != 2) {
isVisited[roomX - 1][roomY] = 1;
}
}
// right
if(roomX < currentLevel.getRooms().length - 1 && currentLevel.getRooms()[roomX + 1][roomY] != null){
if(isVisited[roomX + 1][roomY] != 2) {
isVisited[roomX + 1][roomY] = 1;
}
}
// top
if(roomY > 0 && currentLevel.getRooms()[roomX][roomY - 1] != null){
if(isVisited[roomX][roomY - 1] != 2) {
isVisited[roomX][roomY - 1] = 1;
}
}
// bottom
if(roomY < currentLevel.getRooms().length - 1 && currentLevel.getRooms()[roomX][roomY + 1] != null){
if(isVisited[roomX][roomY + 1] != 2) {
isVisited[roomX][roomY + 1] = 1;
}
}
}
}

@ -19,6 +19,7 @@ public abstract class Entity {
protected boolean targetsPlayer;
protected int standartDef;
protected int def;
protected int exp;
@ -33,6 +34,7 @@ public abstract class Entity {
this.targetsPlayer = true;
this.standartDef = 0;
this.def = 0;
this.exp = 0;
}
public boolean attack(Entity e){
@ -223,4 +225,14 @@ public abstract class Entity {
public int getDef(){
return def;
}
public int getExp(){
return exp;
}
public void setExp(int exp){
this.exp = exp;
}
public void addExp(int exp){
this.exp = this.exp + exp;
}
}

@ -19,6 +19,7 @@ public class Archer extends Entity{
this.dmg = 5*lvl;
this.id = 0;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 70;
maxRange = 210;
attackSpeed = 70;

@ -19,6 +19,7 @@ public class Darkarcher extends Entity{
this.dmg = 7*lvl;
this.id = 27;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 80;
maxRange = 240;
attackSpeed = 100;

@ -13,6 +13,7 @@ public class Darkswordsman extends Entity {
this.direction = 1;
this.dmg = 12*lvl;
this.id = 26;
this.exp = (lvl+1) * 5;
this.type = 0;
// TODO: Sinnvolle Werte finden

@ -28,6 +28,7 @@ public class Darkwizard extends Entity{
this.dmg = 10*lvl;
this.id = 24;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 140;
maxRange = 170;
attackSpeed = 70; // higher = slower

@ -28,6 +28,7 @@ public class Earthwizard extends Entity{
this.dmg = 8*lvl;
this.id = 8;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 60;
maxRange = 150;
attackSpeed = 80;

@ -19,6 +19,7 @@ public class Firearcher extends Entity{
this.dmg = 8*lvl;
this.id = 13;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 60;
maxRange = 200;
attackSpeed = 55;

@ -14,6 +14,7 @@ public class Fireswordsman extends Entity {
this.dmg = 15*lvl;
this.id = 10;
this.type = 0;
this.exp = (lvl+1) * 5;
// TODO: Sinnvolle Werte finden
direction = 2;

@ -28,6 +28,7 @@ public class Firewizard extends Entity{
this.dmg = 9*lvl;
this.id = 6;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 50;
maxRange = 130;
attackSpeed = 60;

@ -28,6 +28,7 @@ public class Healwizard extends Entity{
this.dmg = 12*lvl;
this.id = 20;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 64;
maxRange = 124;
attackSpeed = 60;

@ -19,6 +19,7 @@ public class Icearcher extends Entity{
this.dmg = 7*lvl;
this.id = 11;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 80;
maxRange = 240;
attackSpeed = 100;

@ -14,6 +14,7 @@ public class Iceswordsman extends Entity {
this.dmg = 14*lvl;
this.id = 15;
this.type = 0;
this.exp = (lvl+1) * 5;
// TODO: Sinnvolle Werte finden
direction = 2;

@ -28,6 +28,7 @@ public class Icewizard extends Entity{
this.dmg = 10*lvl;
this.id = 16;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 70;
maxRange = 190;
attackSpeed = 80;

@ -28,6 +28,7 @@ public class Naturewizard extends Entity{
this.dmg = 8*lvl;
this.id = 22;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 60;
maxRange = 150;
attackSpeed = 80;

@ -22,6 +22,8 @@ public class Player extends Entity {
String gender;
float standartMovementSpeed;
float movementSpeed;
int level;
public Player() {
super(200, 200, 1);
@ -49,11 +51,12 @@ public class Player extends Entity {
public void updateStats(int ey){
this.lvl = ey+1;
this.maxhp = 50 * this.lvl;
this.standartMaxHp = 50 * this.lvl;
this.standartDmg = 20 * this.lvl;
this.level = (this.exp / 10) + 1;
this.maxhp = 50 * this.level;
this.standartMaxHp = 50 * this.level;
this.standartDmg = 20 * this.level;
this.dmg = this.standartDmg;
this.standartDef = 4 * lvl;
this.standartDef = 4 * this.level;
this.def = this.standartDef;
updateItems();
}

@ -14,6 +14,7 @@ public class Swordsman extends Entity {
this.dmg = 12*lvl;
this.id = 1;
this.type = 0;
this.exp = (lvl+1) * 5;
// TODO: Sinnvolle Werte finden
direction = 2;

@ -28,6 +28,7 @@ public class Waterwizard extends Entity{
this.dmg = 12*lvl;
this.id = 18;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 65;
maxRange = 130;
attackSpeed = 50;

@ -28,6 +28,7 @@ public class Wizard extends Entity{
this.dmg = 10*lvl;
this.id = 3;
this.type = 1;
this.exp = (lvl+1) * 5;
minRange = 140;
maxRange = 170;
attackSpeed = 70; // higher = slower

@ -0,0 +1,90 @@
package com.dungeoncrawler.view;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Rectangle;
public class Button {
Sprite sprite;
int xPos;
int yPos;
int width;
int height;
int id;
private Rectangle rect;
public Button(String texture, int x, int y, int id) {
this.sprite = new Sprite(new Texture(texture));
rect = sprite.getBoundingRectangle();
this.xPos = x;
this.yPos = y;
this.width = (int) sprite.getWidth();
this.height = (int) sprite.getHeight();
sprite.setX(x);
sprite.setY(y);
this.id = id;
}
public Sprite getSprite() {
return sprite;
}
public void setSprite(Sprite sprite) {
this.sprite = sprite;
}
public int getxPos() {
return xPos;
}
public void setxPos(int xPos) {
this.xPos = xPos;
}
public int getyPos() {
return yPos;
}
public void setyPos(int yPos) {
this.yPos = yPos;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
/**
* @return the rect
*/
public Rectangle getRect() {
return rect;
}
/**
* @param rect the rect to set
*/
public void setRect(Rectangle rect) {
this.rect = rect;
}
}

@ -2,6 +2,7 @@ package com.dungeoncrawler.view;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
@ -9,14 +10,21 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TiledMapRenderer;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.math.Circle;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.dungeoncrawler.model.Dungeon;
import com.dungeoncrawler.model.Entity;
import com.dungeoncrawler.model.entities.*;
import java.awt.Shape;
import java.util.ArrayList;
import java.util.Arrays;
@ -39,10 +47,20 @@ public class GameScreen {
private Map m;
TiledMapRenderer tmr;
TiledMap tm;
OrthographicCamera camera;
public ArrayList<AnimatedObject> objects;
public ArrayList<AnimatedObject> mapItems;
public ArrayList<AnimatedObject> doors;
// MiniMap
ShapeRenderer shapeRenderer;
Sprite miniMapContainer;
int mapX = 10;
int mapY = 310;
int gap = 2;
int rectWidth = 12;
int rectHeight = 7;
float alpha = 0.5f;
Timer animations;
Timer animatePlayer;
@ -65,6 +83,11 @@ public class GameScreen {
public Music music;
//Inventory TEST
// CONTROLS
ArrayList<Button> controls;
int mouseX;
int mouseY;
float animationSpeed = 0.1f;
@ -102,8 +125,6 @@ public class GameScreen {
float h = Gdx.graphics.getHeight();
m = new Map();
camera = new OrthographicCamera(1, h/w);
camera.translate(175f, 215f);
Texture[] tempTextures = new Texture[d.getLevel().length];
@ -115,6 +136,10 @@ public class GameScreen {
m = mg.generateMap(d);
mg.ichWillSpielen(m.getMaps());
shapeRenderer = new ShapeRenderer();
miniMapContainer = new Sprite(new Texture(Gdx.files.internal("sprites/miniMapContainer.png")));
miniMapContainer.setPosition(mapX - 10, mapY - 20);
tm = new TiledMap();
tmr = new OrthogonalTiledMapRenderer(tm);
@ -175,14 +200,44 @@ public class GameScreen {
}
}
},0, 0.03f);
// CONTROLS
controls = new ArrayList();
int hudX = -160;
int hudY = 25;
controls.add(new Button("sprites/controls/arrowLeft.png", hudX + 0, hudY + 50, 0));
controls.add(new Button("sprites/controls/arrowUp.png", hudX + 50, hudY + 100, 1));
controls.add(new Button("sprites/controls/arrowRight.png", hudX + 100, hudY + 50, 2));
controls.add(new Button("sprites/controls/arrowDown.png", hudX + 50, hudY + 0, 3));
controls.add(new Button("sprites/controls/arrowLeft.png", 550-170, 75, 4));
controls.add(new Button("sprites/controls/arrowUp.png", 600-170, 125, 5));
controls.add(new Button("sprites/controls/arrowRight.png", 650-170, 75, 6));
controls.add(new Button("sprites/controls/arrowDown.png", 600-170, 25, 7));
controls.add(new Button("sprites/controls/pickUp.png", 160-110-40, 30, 8));
controls.add(new Button("sprites/controls/equip1.png", 160-110-40, 120, 9));
controls.add(new Button("sprites/controls/drop.png", 160+110+40, 30, 10));
controls.add(new Button("sprites/controls/equip2.png", 160+110+40, 120, 11));
controls.add(new Button("sprites/controls/use.png", 600-170, 200, 12));
// INVENTORY
controls.add(new Button("sprites/controls/inventorySlot.png", -118, 334, 20)); //0
controls.add(new Button("sprites/controls/inventorySlot.png", -69, 334, 21)); //1
controls.add(new Button("sprites/controls/inventorySlot.png", -144, 282, 22)); //2
controls.add(new Button("sprites/controls/inventorySlot.png", -92, 282, 23)); //3
controls.add(new Button("sprites/controls/inventorySlot.png", -42, 282, 24)); //4
controls.add(new Button("sprites/controls/inventorySlot.png", -144, 231, 25)); //5
controls.add(new Button("sprites/controls/inventorySlot.png", -92, 231, 26)); //6
controls.add(new Button("sprites/controls/inventorySlot.png", -42, 231, 27)); //7
}
public void render (SpriteBatch batch, Player p, Entity[] e, int tileX, int tileY, int level, int roomPosX, int roomPosY) {
public void render (SpriteBatch batch, Player p, Entity[] e, int tileX, int tileY, int level, int roomPosX, int roomPosY, OrthographicCamera camera, int[][] miniMap, boolean touch) {
shapeRenderer.setProjectionMatrix(camera.combined);
entities = e;
this.p = p;
//playerMoving = (p.getMovementX() != 0 || p.getMovementY() != 0);
@ -210,10 +265,6 @@ public class GameScreen {
tmr.setView(camera);
tmr.render();
camera.zoom = 700f; // Standart 700f
camera.update();
batch.setProjectionMatrix(camera.combined);
updateEntitySprites(e);
ArrayList<EntitySprite> temp = new ArrayList<>();
@ -266,8 +317,63 @@ public class GameScreen {
font.draw(batch, text, dmgContainer[x].getCurrentX(), dmgContainer[x].getCurrentY());
}
}
if(touch)
for(Button button : controls){
button.getSprite().draw(batch);
}
miniMapContainer.draw(batch);
batch.end();
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
for(int i = 0; i < miniMap.length; i++){
for(int j = 0; j < miniMap.length; j++){
// current Room
if(i == roomPosX && j == roomPosY){
shapeRenderer.setColor(0, 0.75f, 0, alpha);
}
// not found
else if(miniMap[i][j] == 0){
shapeRenderer.setColor(0, 0, 0, alpha);
}
// found
else if(miniMap[i][j] == 1){
shapeRenderer.setColor(0.2f, 0.2f, 0.2f, alpha);
}
// visited
else if(miniMap[i][j] == 2){
shapeRenderer.setColor(0.5f, 0.5f, 0.5f, alpha);
}
if(miniMap[i][j] != 0) {
shapeRenderer.rect(i * gap + i * rectWidth + mapX, j * gap + j * rectHeight + mapY, rectWidth, rectHeight);
shapeRenderer.setColor(Color.RED);
}
}
}
shapeRenderer.end();
Gdx.gl.glDisable(GL20.GL_BLEND);
// BUTTON HITBOXES
/*
ShapeRenderer lol = new ShapeRenderer();
lol.setProjectionMatrix(camera.combined);
lol.begin(ShapeRenderer.ShapeType.Filled);
for(Button button : controls){
lol.rect(button.getxPos(), button.getyPos(), button.getWidth(), button.getHeight());
}
lol.circle(mouseX,mouseY,15);
lol.end();
*/
}
public void generateEntitySprites(Entity[] e){
@ -441,8 +547,10 @@ public class GameScreen {
}
public void deleteEntitySprite(int i){
entitySprites[i].getSprites()[0].getTexture().dispose();
entitySprites[i] = null;
}
public void updateDamageContainer(){
for(int x = 0; x < dmgContainer.length; x++){
@ -496,20 +604,14 @@ public class GameScreen {
}
public void stop(){
camera.zoom = 1600;
camera.translate(625f, 241f);
animations.stop();
animatePlayer.stop();
}
public void resume(){
camera.zoom = 700;
camera.translate(-625f, -241f);
animations.start();
animatePlayer.start();
}
public void end(){
camera.zoom = 1600;
camera.translate(625f, 241f);
animations.stop();
animatePlayer.stop();
cleanUp();
@ -523,8 +625,19 @@ public class GameScreen {
}
}
}
public OrthographicCamera getCamera(){
return camera;
public ArrayList<Integer> click(int x, int y, Viewport viewport){
x = (int)viewport.unproject(new Vector2(x,y)).x;
y = (int)viewport.unproject(new Vector2(x,y)).y;
Circle r = new Circle(x,y,5);
mouseX = x;
mouseY = y;
ArrayList<Integer> clicks = new ArrayList();
Circle mouse = new Circle(x,y,20);
for(Button button : controls){
if(Intersector.overlaps(mouse, button.getSprite().getBoundingRectangle())){
clicks.add(button.getId());
}
}
return clicks;
}
}

@ -28,6 +28,8 @@ public class HudContainer {
Sprite playerHealthSprite;
float playerHealthX;
float playerHealthY;
Sprite textboxSprite;
BitmapFont font;
float HudPosX;
@ -51,6 +53,8 @@ public class HudContainer {
InventoryItemSprites = new Sprite[8];
invXPos = new float[8];
invYPos = new float[8];
textboxSprite = new Sprite(new Texture("sprites/textbox.png"));
textboxSprite.setPosition(HudSprite.getX() + 21, HudSprite.getY() + 148);
Texture inv = new Texture("sprites/hudInventory.png");
Inventory = new Sprite(inv);
@ -64,10 +68,10 @@ public class HudContainer {
HudPosY = HudSprite.getY();
playerHealthX = HudPosX+36f;
playerHealthY = HudPosY+260f;
playerHealthY = HudPosY+357f;
healthBarContainer.setPosition(HudPosX + 8,HudPosY + 252);
Inventory.setPosition(HudPosX + 7,HudPosY + 7);
healthBarContainer.setPosition(HudPosX + 8,HudPosY + 349);
Inventory.setPosition(HudPosX + 7,HudPosY + 190); // 140 215
float InvX = Inventory.getX();
float InvY = Inventory.getY();
@ -150,6 +154,7 @@ public class HudContainer {
}
selectedSprite.draw(batch);
playerHealthSprite.draw(batch);
textboxSprite.draw(batch);
font.draw(batch, p.getHp() + " / " + p.getMaxhp(), playerHealthSprite.getX()+18, playerHealthSprite.getY()+14);
if(items[selected] != null){
@ -179,8 +184,9 @@ public class HudContainer {
break;
}
font.draw(batch, selectedName + lvl, HudPosX + 40, HudPosY + 210);
font.draw(batch, perk + selectedPerkValue, HudPosX + 40, HudPosY + 190);
font.draw(batch, selectedName + lvl, HudPosX + 40, HudPosY + 184);
font.draw(batch, perk + selectedPerkValue, HudPosX + 40, HudPosY + 164);
}
@ -233,4 +239,20 @@ public class HudContainer {
public void setSelected(int i){
selected = i;
}
public float getHudPosX() {
return HudPosX;
}
public void setHudPosX(float hudPosX) {
HudPosX = hudPosX;
}
public float getHudPosY() {
return HudPosY;
}
public void setHudPosY(float hudPosY) {
HudPosY = hudPosY;
}
}

@ -10,9 +10,12 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Circle;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.viewport.Viewport;
public class MainMenuScreen{
@ -26,6 +29,9 @@ public class MainMenuScreen{
Sprite settingsButtonSprite;
Sprite maleButton;
Sprite femaleButton;
BitmapFont font;
Vector2 lastMousePos = new Vector2(0,0);
boolean hidden;
@ -51,7 +57,7 @@ public class MainMenuScreen{
Sprite buttonLeft;
String gender;
Texture cursor;
public MainMenuScreen(float volume) {
@ -61,9 +67,10 @@ public class MainMenuScreen{
float wc = w/2;
gender = "m";
font = new BitmapFont();
hidden = false;
cursor = new Texture("sprites/cursor.png");
Texture backgroundTexture = new Texture("sprites/MAINSCREEN.png");
Texture startButtonTexture = new Texture("sprites/startButton.png");
Texture quitButtonTexture = new Texture("sprites/quitButton.png");
@ -137,6 +144,8 @@ public class MainMenuScreen{
playerSprite.setRegion(playerRegion[shownPlayer][0][animationState]);
}
},0, 0.1f);
// Sound
@ -149,7 +158,7 @@ public class MainMenuScreen{
public void render (SpriteBatch batch) {
batch.begin();
//batch.setProjectionMatrix(camera.combined);
if(hidden == false){
@ -165,7 +174,7 @@ public class MainMenuScreen{
playerSprite.draw(batch);
batch.draw(cursor, lastMousePos.x, lastMousePos.y);
if(gender.equals("m")){
maleButton.draw(batch);
@ -174,15 +183,21 @@ public class MainMenuScreen{
femaleButton.draw(batch);
}
}
batch.end();
}
public int click(int x, int y){ // prueft ob cursor mit button (START) ueberlappt
public int click(int x, int y, Viewport viewport){ // prueft ob cursor mit button (START) ueberlappt
if(hidden == false){
Rectangle r = new Rectangle();
r.set(x, h-y, 1, 1);
//x = (int)((Gdx.graphics.getWidth() - viewport.getWorldWidth()) / 2f) + (int)(((float)x/(float)Gdx.graphics.getWidth()) * 1600) ;
//x -= (int)(x*((float)x/(float)Gdx.graphics.getWidth()));
x = (int)viewport.unproject(new Vector2(x,y)).x;
y = (int)h-y;
lastMousePos = new Vector2(x,y);
Circle r = new Circle(x,y,10);
if(Intersector.overlaps(r, startButtonSprite.getBoundingRectangle())){
return 0; //go ingame
}

@ -15,8 +15,11 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Circle;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.viewport.Viewport;
/**
*
@ -25,7 +28,8 @@ import com.badlogic.gdx.math.Rectangle;
public class PauseScreen{
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
Vector2 lastMousePos = new Vector2(0,0);
BitmapFont font;
@ -36,7 +40,9 @@ public class PauseScreen{
Texture backButtonTexture;
Texture quitButtonTexture;
Texture controlsButtonTexture;
Texture cursor;
Sprite controlsButtonSprite;
Sprite volumeButtonSprite;
Sprite volumeUpSprite;
@ -56,7 +62,8 @@ public class PauseScreen{
float wc = w/2;
showControls = false;
font = new BitmapFont();
cursor = new Texture("sprites/cursor.png");
controlsButtonTexture = new Texture("sprites/controlsButton.png");
volumeButtonTexture = new Texture("sprites/volumeButton.png");
volumeUpTexture = new Texture("sprites/volumeUpButton.png");
@ -87,7 +94,7 @@ public class PauseScreen{
public void render (SpriteBatch batch, float volume, OrthographicCamera camera) {
float n = 0;
@ -119,6 +126,7 @@ public class PauseScreen{
backButtonSprite.draw(batch);
controlsButtonSprite.draw(batch);
//quitButtonSprite.draw(batch);
batch.draw(cursor, lastMousePos.x, lastMousePos.y);
if(showControls){
@ -158,12 +166,13 @@ public class PauseScreen{
}
public int click(int x, int y){ // prueft ob cursor mit button (START) ueberlappt
Rectangle r = new Rectangle();
r.set(x, h-y, 1600, 900);
public int click(int x, int y, Viewport viewport){ // prueft ob cursor mit button (START) ueberlappt
x = (int)viewport.unproject(new Vector2(x,y)).x;
y = (int)h-y;
lastMousePos = new Vector2(x, y);
Circle r = new Circle(x,y,10);
/*
if(Intersector.overlaps(r, quitButtonSprite.getBoundingRectangle())){
return 11; //restart Game

@ -11,8 +11,11 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Circle;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.viewport.Viewport;
/**
*
@ -101,12 +104,12 @@ public class SettingsScreen {
}
public int click(int x, int y){ // prueft ob cursor mit button (START) ueberlappt
Rectangle r = new Rectangle();
r.set(x, h-y, 1, 1);
public int click(int x, int y, Viewport viewport){ // prueft ob cursor mit button (START) ueberlappt
x = (int)viewport.unproject(new Vector2(x,y)).x;
y = (int)h-y;
Circle r = new Circle(x,y,10);
if(Intersector.overlaps(r, controlsButtonSprite.getBoundingRectangle())){
return 3; //ControlsScreen
}

@ -9,6 +9,7 @@ public class DesktopLauncher {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = 1600;
config.height = 900;
config.samples = 0;
new LwjglApplication(new Controller(), config);
}
}

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

Loading…
Cancel
Save