Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.finn.pokemon.util;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.files.FileHandle;
- import com.badlogic.gdx.physics.box2d.Contact;
- import com.badlogic.gdx.physics.box2d.ContactImpulse;
- import com.badlogic.gdx.physics.box2d.ContactListener;
- import com.badlogic.gdx.physics.box2d.Manifold;
- import com.finn.pokemon.screen.GameScreen;
- import com.finn.pokemon.screen.Level;
- import java.util.HashMap;
- public class DoorTouchEvent implements ContactListener {
- HashMap<Level, Level> doorLinks = new HashMap();
- GameScreen screenReference;
- public DoorTouchEvent(HashMap<String, Level> levelsInGame, GameScreen Screen) {
- screenReference = Screen;
- Level[] Array = (Level[]) levelsInGame.values().toArray();
- for(int i = 0; i < Array.length; i++) {
- for(int j = 0; j < Array.length; j++) {
- if(j == i) {
- continue;
- }
- if(Array[i].tiledMapGetMap().getLayers().get("Doors").getObjects().get("Name").equals(Array[j].tiledMapGetMap().getLayers().get("Doors").getObjects().get("Name"))) {
- doorLinks.put(Array[i],Array[j]);
- doorLinks.put(Array[j],Array[i]);
- }
- }
- }
- }
- @Override
- public void beginContact(Contact contact) {
- if(contact.getFixtureA().getBody().getUserData().equals("door") || contact.getFixtureB().getBody().getUserData().equals("door")) {
- //screenReference.setMap();
- }
- }
- @Override
- public void endContact(Contact contact) {
- }
- @Override
- public void preSolve(Contact contact, Manifold oldManifold) {
- }
- @Override
- public void postSolve(Contact contact, ContactImpulse impulse) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement