Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. package com.finn.pokemon.util;
  2.  
  3. import com.badlogic.gdx.Gdx;
  4. import com.badlogic.gdx.files.FileHandle;
  5. import com.badlogic.gdx.physics.box2d.Contact;
  6. import com.badlogic.gdx.physics.box2d.ContactImpulse;
  7. import com.badlogic.gdx.physics.box2d.ContactListener;
  8. import com.badlogic.gdx.physics.box2d.Manifold;
  9. import com.finn.pokemon.screen.GameScreen;
  10. import com.finn.pokemon.screen.Level;
  11.  
  12. import java.util.HashMap;
  13.  
  14.  
  15. public class DoorTouchEvent implements ContactListener {
  16. HashMap<Level, Level> doorLinks = new HashMap();
  17. GameScreen screenReference;
  18.  
  19. public DoorTouchEvent(HashMap<String, Level> levelsInGame, GameScreen Screen) {
  20. screenReference = Screen;
  21. Level[] Array = (Level[]) levelsInGame.values().toArray();
  22. for(int i = 0; i < Array.length; i++) {
  23. for(int j = 0; j < Array.length; j++) {
  24. if(j == i) {
  25. continue;
  26. }
  27. if(Array[i].tiledMapGetMap().getLayers().get("Doors").getObjects().get("Name").equals(Array[j].tiledMapGetMap().getLayers().get("Doors").getObjects().get("Name"))) {
  28. doorLinks.put(Array[i],Array[j]);
  29. doorLinks.put(Array[j],Array[i]);
  30. }
  31. }
  32. }
  33. }
  34.  
  35. @Override
  36. public void beginContact(Contact contact) {
  37. if(contact.getFixtureA().getBody().getUserData().equals("door") || contact.getFixtureB().getBody().getUserData().equals("door")) {
  38. //screenReference.setMap();
  39. }
  40. }
  41.  
  42. @Override
  43. public void endContact(Contact contact) {
  44.  
  45. }
  46.  
  47. @Override
  48. public void preSolve(Contact contact, Manifold oldManifold) {
  49.  
  50. }
  51.  
  52. @Override
  53. public void postSolve(Contact contact, ContactImpulse impulse) {
  54.  
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement