Advertisement
LUMIN0X

Untitled

Dec 14th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 42.20 KB | None | 0 0
  1. package io.github.supplied;
  2.  
  3. import com.badlogic.gdx.Application;
  4. import com.badlogic.gdx.ApplicationAdapter;
  5. import com.badlogic.gdx.Gdx;
  6. import com.badlogic.gdx.Input;
  7. import com.badlogic.gdx.InputAdapter;
  8. import com.badlogic.gdx.assets.AssetManager;
  9. import com.badlogic.gdx.audio.Music;
  10. import com.badlogic.gdx.audio.Sound;
  11. import com.badlogic.gdx.graphics.Color;
  12. import com.badlogic.gdx.graphics.PerspectiveCamera;
  13. import com.badlogic.gdx.graphics.Texture;
  14. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  15. import com.badlogic.gdx.graphics.g3d.Environment;
  16. import com.badlogic.gdx.graphics.g3d.Material;
  17. import com.badlogic.gdx.graphics.g3d.Model;
  18. import com.badlogic.gdx.graphics.g3d.ModelBatch;
  19. import com.badlogic.gdx.graphics.g3d.ModelInstance;
  20. import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
  21. import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
  22. import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
  23. import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
  24. import com.badlogic.gdx.math.Matrix4;
  25. import com.badlogic.gdx.math.Vector3;
  26. import com.badlogic.gdx.physics.bullet.Bullet;
  27. import com.badlogic.gdx.physics.bullet.collision.ContactCallbackEvent;
  28. import com.badlogic.gdx.physics.bullet.collision.btBoxShape;
  29. import com.badlogic.gdx.physics.bullet.collision.btCollisionConfiguration;
  30. import com.badlogic.gdx.physics.bullet.collision.btCollisionDispatcher;
  31. import com.badlogic.gdx.physics.bullet.collision.btCollisionShape;
  32. import com.badlogic.gdx.physics.bullet.collision.btDbvtBroadphase;
  33. import com.badlogic.gdx.physics.bullet.collision.btDefaultCollisionConfiguration;
  34. import com.badlogic.gdx.physics.bullet.collision.btDispatcher;
  35. import com.badlogic.gdx.physics.bullet.dynamics.btDiscreteDynamicsWorld;
  36. import com.badlogic.gdx.physics.bullet.dynamics.btRigidBody;
  37. import com.badlogic.gdx.physics.bullet.linearmath.btDefaultMotionState;
  38. import com.badlogic.gdx.physics.bullet.linearmath.btMotionState;
  39. import java.math.BigInteger;
  40. import java.nio.charset.StandardCharsets;
  41. import java.security.MessageDigest;
  42. import java.security.NoSuchAlgorithmException;
  43. import java.util.ArrayList;
  44. import java.util.List;
  45. import java.util.Random;
  46.  
  47. /* loaded from: classes3.dex */
  48. public class Main extends ApplicationAdapter {
  49.     private AssetManager assetManager;
  50.     public ModelInstance backWallInstance;
  51.     public Model backWallModel;
  52.     private Music backgroundMusic;
  53.     private btDbvtBroadphase broadphase;
  54.     public PerspectiveCamera cam;
  55.     private btCollisionConfiguration collisionConfig;
  56.     private btDispatcher dispatcher;
  57.     private btDiscreteDynamicsWorld dynamicsWorld;
  58.     public Environment environment;
  59.     public ModelInstance floorInstance;
  60.     public Model floorModel;
  61.     public ModelInstance frontWallInstance;
  62.     public Model frontWallModel;
  63.     public String hash;
  64.     private Texture jumpscareImage;
  65.     private Sound jumpscareSound;
  66.     public ModelInstance leftWallInstance;
  67.     public Model leftWallModel;
  68.     public MessageDigest md;
  69.     public ModelBatch modelBatch;
  70.     private btRigidBody playerBody;
  71.     public ModelInstance playerInstance;
  72.     public Model playerModel;
  73.     private btCollisionShape playerShape;
  74.     public Vector3 position;
  75.     public ModelInstance rightWallInstance;
  76.     public Model rightWallModel;
  77.     private Sound scareSound;
  78.     private ShapeRenderer shapeRenderer;
  79.     private SpriteBatch spriteBatch;
  80.     public Model wallModel;
  81.     Random rand = new Random();
  82.     public int state = this.rand.nextInt() % 256;
  83.     private float jumpscareTimer = 0.0f;
  84.     public float JUMPSCARE_INTERVAL = (this.rand.nextFloat() * 10.0f) + 10.0f;
  85.     public final float SCARE_INTERVAL = (this.rand.nextFloat() * 7.0f) + 3.0f;
  86.     private boolean jumpscareTriggered = false;
  87.     private boolean scareTriggered = false;
  88.     private List<Model> Models = new ArrayList();
  89.     public List<int[]> offsets = new ArrayList();
  90.     public List<int[]> repeatedList = new ArrayList();
  91.     public List<Vector3> positions = new ArrayList();
  92.     private List<ModelInstance> ModelInstances = new ArrayList();
  93.     private float movementSpeed = 900.0f;
  94.     private List<btRigidBody> environmentBodies = new ArrayList();
  95.     private List<ModelInstance> modelInstances = new ArrayList<>();
  96.     private int selectedModelIndex = 0;
  97.  
  98.     @Override // com.badlogic.gdx.ApplicationAdapter, com.badlogic.gdx.ApplicationListener
  99.     public void create() {
  100.         Bullet.init();
  101.         this.assetManager = new AssetManager();
  102.         this.spriteBatch = new SpriteBatch();
  103.         this.jumpscareImage = new Texture("jumpscare.jpeg");
  104.         this.jumpscareSound = Gdx.audio.newSound(Gdx.files.internal("jumpscare.wav"));
  105.         this.scareSound = Gdx.audio.newSound(Gdx.files.internal("jumpscare.mp3"));
  106.         this.backgroundMusic = Gdx.audio.newMusic(Gdx.files.internal("background.wav"));
  107.         this.backgroundMusic.setLooping(true);
  108.         this.backgroundMusic.setVolume(0.5f);
  109.         this.backgroundMusic.play();
  110.         this.environment = new Environment();
  111.         this.environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.1f, 0.1f, 0.15f, 1.0f));
  112.         this.environment.add(new DirectionalLight().set(0.3f, 0.3f, 0.5f, -1.0f, -0.5f, -0.2f));
  113.         // Set ambient light to white and brighter intensity
  114.         this.environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1.0f, 1.0f, 1.0f, 1.0f));
  115.         Gdx.graphics.setFullscreenMode( Gdx.graphics.getDisplayMode() );
  116.  
  117.  
  118. // Add a white directional light
  119.         this.environment.add(new DirectionalLight().set(1.0f, 1.0f, 1.0f, -1.0f, -0.5f, -0.2f));
  120.         this.cam = new PerspectiveCamera(75.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  121.         this.cam.position.set(0.0f, 5.0f, 0.0f);
  122.         this.cam.far = 1000000.0f;
  123.         this.cam.update();
  124.         this.modelBatch = new ModelBatch();
  125.         this.shapeRenderer = new ShapeRenderer();
  126.         loadModels();
  127.         setupPhysicsWorld();
  128.     }
  129.  
  130.     private void loadModels() {
  131.         for (char i = 0; i <= 187; i = (char) (i + 1)) {
  132.             String modelName = Integer.toString(i) + ".g3db";
  133.             this.assetManager.load(modelName, Model.class);
  134.         }
  135.         this.assetManager.finishLoading();
  136.         float xOffset = 0.0f;
  137.         for (char i2 = 0; i2 <= 187; i2 = (char) (i2 + 1)) {
  138.             String modelName2 = Integer.toString(i2) + ".g3db";
  139.             Model model = (Model) this.assetManager.get(modelName2, Model.class);
  140.             ModelInstance instance = new ModelInstance(model);
  141.             instance.transform.setToTranslation(xOffset, 0.0f, 0.0f);
  142.             this.Models.add(model);
  143.             this.ModelInstances.add(instance);
  144.             xOffset += 100.0f;
  145.         }
  146.         this.ModelInstances.get(0).transform.setToTranslation(29455.0f, -800.0f, 44968.0f);
  147.         this.ModelInstances.get(1).transform.setToTranslation(50415.0f, 350.0f, -27154.0f);
  148.         this.ModelInstances.get(2).transform.setToTranslation(20321.0f, 380.0f, -23095.0f);
  149.         this.ModelInstances.get(3).transform.setToTranslation(16609.0f, -810.0f, 14772.0f);
  150.         this.ModelInstances.get(4).transform.setToTranslation(31910.0f, -910.0f, 25007.0f);
  151.         this.ModelInstances.get(5).transform.setToTranslation(47547.0f, -940.0f, -31146.0f);
  152.         this.ModelInstances.get(6).transform.setToTranslation(55754.0f, 470.0f, 27242.0f);
  153.         this.ModelInstances.get(7).transform.setToTranslation(54879.0f, -770.0f, -778.0f);
  154.         this.ModelInstances.get(8).transform.setToTranslation(29055.0f, -900.0f, 15768.0f);
  155.         this.ModelInstances.get(9).transform.setToTranslation(51215.0f, 940.0f, -31654.0f);
  156.         this.ModelInstances.get(10).transform.setToTranslation(23021.0f, -820.0f, 2905.0f);
  157.         this.ModelInstances.get(11).transform.setToTranslation(14609.0f, -810.0f, 14842.0f);
  158.         this.ModelInstances.get(12).transform.setToTranslation(33110.0f, -920.0f, 51927.0f);
  159.         this.ModelInstances.get(13).transform.setToTranslation(48147.0f, -980.0f, -34146.0f);
  160.         this.ModelInstances.get(14).transform.setToTranslation(56354.0f, 420.0f, 24742.0f);
  161.         this.ModelInstances.get(15).transform.setToTranslation(56379.0f, -810.0f, 27942.0f);
  162.         this.ModelInstances.get(16).transform.setToTranslation(29555.0f, 450.0f, 13768.0f);
  163.         this.ModelInstances.get(17).transform.setToTranslation(50915.0f, -820.0f, -1744.0f);
  164.         this.ModelInstances.get(18).transform.setToTranslation(31221.0f, -420.0f, -29595.0f);
  165.         this.ModelInstances.get(19).transform.setToTranslation(18009.0f, -260.0f, -76928.0f);
  166.         this.ModelInstances.get(20).transform.setToTranslation(36710.0f, 490.0f, 20507.0f);
  167.         this.ModelInstances.get(21).transform.setToTranslation(47247.0f, -820.0f, -3696.0f);
  168.         this.ModelInstances.get(22).transform.setToTranslation(61354.0f, 520.0f, 24742.0f);
  169.         this.ModelInstances.get(23).transform.setToTranslation(65539.0f, -530.0f, -2278.0f);
  170.         this.ModelInstances.get(24).transform.setToTranslation(36455.0f, -5220.0f, 15268.0f);
  171.         this.ModelInstances.get(25).transform.setToTranslation(52915.0f, -820.0f, -1774.0f);
  172.         this.ModelInstances.get(26).transform.setToTranslation(20021.0f, -810.0f, 2875.0f);
  173.         this.ModelInstances.get(27).transform.setToTranslation(24109.0f, 60.0f, -14428.0f);
  174.         this.ModelInstances.get(28).transform.setToTranslation(42810.0f, -480.0f, 23007.0f);
  175.         this.ModelInstances.get(29).transform.setToTranslation(49647.0f, -500.0f, -32146.0f);
  176.         this.ModelInstances.get(30).transform.setToTranslation(57854.0f, 510.0f, 27742.0f);
  177.         this.ModelInstances.get(31).transform.setToTranslation(56979.0f, -520.0f, 722.0f);
  178.         this.ModelInstances.get(32).transform.setToTranslation(28655.0f, -800.0f, 45238.0f);
  179.         this.ModelInstances.get(33).transform.setToTranslation(52115.0f, -810.0f, -1694.0f);
  180.         this.ModelInstances.get(34).transform.setToTranslation(23021.0f, 40.0f, -24095.0f);
  181.         this.ModelInstances.get(35).transform.setToTranslation(15209.0f, -810.0f, 14992.0f);
  182.         this.ModelInstances.get(36).transform.setToTranslation(34710.0f, -320.0f, 25507.0f);
  183.         this.ModelInstances.get(37).transform.setToTranslation(50347.0f, 550.0f, -29646.0f);
  184.         this.ModelInstances.get(38).transform.setToTranslation(58554.0f, 760.0f, 30242.0f);
  185.         this.ModelInstances.get(39).transform.setToTranslation(55179.0f, -820.0f, 27892.0f);
  186.         this.ModelInstances.get(40).transform.setToTranslation(30255.0f, -900.0f, 44968.0f);
  187.         this.ModelInstances.get(41).transform.setToTranslation(52715.0f, -920.0f, -1704.0f);
  188.         this.ModelInstances.get(42).transform.setToTranslation(24421.0f, -520.0f, -47295.0f);
  189.         this.ModelInstances.get(74).transform.setToTranslation(17769.0f, 750.0f, 21182.0f);
  190.         this.ModelInstances.get(75).transform.setToTranslation(25840.0f, 360.0f, 58877.0f);
  191.         this.ModelInstances.get(76).transform.setToTranslation(52397.0f, -590.0f, 9384.0f);
  192.         this.ModelInstances.get(77).transform.setToTranslation(63484.0f, -360.0f, 60702.0f);
  193.         this.ModelInstances.get(78).transform.setToTranslation(59699.0f, -250.0f, 26372.0f);
  194.         this.ModelInstances.get(79).transform.setToTranslation(36725.0f, -770.0f, 48498.0f);
  195.         this.ModelInstances.get(80).transform.setToTranslation(56445.0f, -700.0f, 8486.0f);
  196.         this.ModelInstances.get(81).transform.setToTranslation(25851.0f, -340.0f, 6035.0f);
  197.         this.ModelInstances.get(82).transform.setToTranslation(19879.0f, -130.0f, 22612.0f);
  198.         this.ModelInstances.get(83).transform.setToTranslation(29000.0f, 270.0f, 61247.0f);
  199.         this.ModelInstances.get(84).transform.setToTranslation(55007.0f, 720.0f, 8804.0f);
  200.         this.ModelInstances.get(85).transform.setToTranslation(54654.0f, 350.0f, 64882.0f);
  201.         this.ModelInstances.get(86).transform.setToTranslation(56339.0f, -390.0f, 26172.0f);
  202.         this.ModelInstances.get(87).transform.setToTranslation(31925.0f, -640.0f, 47858.0f);
  203.         this.ModelInstances.get(88).transform.setToTranslation(59775.0f, 380.0f, 6.0f);
  204.         this.ModelInstances.get(89).transform.setToTranslation(16791.0f, -110.0f, 13535.0f);
  205.         this.ModelInstances.get(90).transform.setToTranslation(10899.0f, -560.0f, 15302.0f);
  206.         this.ModelInstances.get(91).transform.setToTranslation(33950.0f, 680.0f, 64057.0f);
  207.         this.ModelInstances.get(92).transform.setToTranslation(48887.0f, 340.0f, -1036.0f);
  208.         this.ModelInstances.get(93).transform.setToTranslation(52644.0f, 180.0f, 61342.0f);
  209.         this.ModelInstances.get(94).transform.setToTranslation(60249.0f, -70.0f, 38322.0f);
  210.         this.ModelInstances.get(95).transform.setToTranslation(26225.0f, 680.0f, 49458.0f);
  211.         this.ModelInstances.get(96).transform.setToTranslation(47255.0f, 710.0f, -2594.0f);
  212.         this.ModelInstances.get(97).transform.setToTranslation(18851.0f, 330.0f, 10895.0f);
  213.         this.ModelInstances.get(98).transform.setToTranslation(17039.0f, -710.0f, 20192.0f);
  214.         this.ModelInstances.get(99).transform.setToTranslation(26290.0f, 230.0f, 57247.0f);
  215.         this.ModelInstances.get(100).transform.setToTranslation(44167.0f, 760.0f, -476.0f);
  216.         this.ModelInstances.get(101).transform.setToTranslation(56384.0f, -730.0f, 59502.0f);
  217.         this.ModelInstances.get(102).transform.setToTranslation(57979.0f, 400.0f, 36182.0f);
  218.         this.ModelInstances.get(Input.Keys.BUTTON_R1).transform.setToTranslation(31705.0f, -160.0f, 54168.0f);
  219.         this.ModelInstances.get(Input.Keys.BUTTON_L2).transform.setToTranslation(49075.0f, 20.0f, 576.0f);
  220.         this.ModelInstances.get(Input.Keys.BUTTON_R2).transform.setToTranslation(13881.0f, 120.0f, 14555.0f);
  221.         this.ModelInstances.get(Input.Keys.BUTTON_THUMBL).transform.setToTranslation(18549.0f, 290.0f, 20112.0f);
  222.         this.ModelInstances.get(Input.Keys.BUTTON_THUMBR).transform.setToTranslation(31250.0f, 700.0f, 57637.0f);
  223.         this.ModelInstances.get(Input.Keys.BUTTON_START).transform.setToTranslation(41767.0f, 30.0f, 7454.0f);
  224.         this.ModelInstances.get(Input.Keys.BUTTON_SELECT).transform.setToTranslation(62624.0f, -590.0f, 56312.0f);
  225.         this.ModelInstances.get(Input.Keys.BUTTON_MODE).transform.setToTranslation(58099.0f, 70.0f, 40592.0f);
  226.         this.ModelInstances.get(Input.Keys.ESCAPE).transform.setToTranslation(23575.0f, 670.0f, 55128.0f);
  227.         this.ModelInstances.get(Input.Keys.FORWARD_DEL).transform.setToTranslation(50835.0f, -670.0f, -2204.0f);
  228.         this.ModelInstances.get(113).transform.setToTranslation(15411.0f, 730.0f, 3255.0f);
  229.         this.ModelInstances.get(114).transform.setToTranslation(15989.0f, -550.0f, 18582.0f);
  230.         this.ModelInstances.get(Input.Keys.CAPS_LOCK).transform.setToTranslation(26420.0f, 140.0f, 59297.0f);
  231.         this.ModelInstances.get(Input.Keys.SCROLL_LOCK).transform.setToTranslation(46217.0f, -30.0f, 5724.0f);
  232.         this.ModelInstances.get(117).transform.setToTranslation(63254.0f, 200.0f, 55272.0f);
  233.         this.ModelInstances.get(118).transform.setToTranslation(58809.0f, 110.0f, 39882.0f);
  234.         this.ModelInstances.get(119).transform.setToTranslation(22075.0f, 170.0f, 43138.0f);
  235.         this.ModelInstances.get(Input.Keys.PRINT_SCREEN).transform.setToTranslation(45675.0f, -370.0f, 7236.0f);
  236.         this.ModelInstances.get(Input.Keys.PAUSE).transform.setToTranslation(27291.0f, -160.0f, 14635.0f);
  237.         this.ModelInstances.get(122).transform.setToTranslation(22429.0f, -460.0f, 15162.0f);
  238.         this.ModelInstances.get(Input.Keys.END).transform.setToTranslation(35030.0f, -540.0f, 55047.0f);
  239.         this.ModelInstances.get(Input.Keys.INSERT).transform.setToTranslation(48847.0f, -100.0f, 8974.0f);
  240.         this.ModelInstances.get(125).transform.setToTranslation(63684.0f, 530.0f, 63242.0f);
  241.         this.ModelInstances.get(126).transform.setToTranslation(56619.0f, -60.0f, 32152.0f);
  242.         this.ModelInstances.get(127).transform.setToTranslation(23975.0f, -350.0f, 56288.0f);
  243.         this.ModelInstances.get(128).transform.setToTranslation(50575.0f, -430.0f, 5576.0f);
  244.         this.ModelInstances.get(Input.Keys.CONTROL_LEFT).transform.setToTranslation(23201.0f, 100.0f, 9855.0f);
  245.         this.ModelInstances.get(Input.Keys.CONTROL_RIGHT).transform.setToTranslation(12579.0f, -600.0f, 16042.0f);
  246.         this.ModelInstances.get(Input.Keys.F1).transform.setToTranslation(30150.0f, -580.0f, 60817.0f);
  247.         this.ModelInstances.get(Input.Keys.F2).transform.setToTranslation(49887.0f, 470.0f, -516.0f);
  248.         this.ModelInstances.get(Input.Keys.F3).transform.setToTranslation(63194.0f, -610.0f, 66392.0f);
  249.         this.ModelInstances.get(Input.Keys.F4).transform.setToTranslation(61929.0f, 760.0f, 29002.0f);
  250.         this.ModelInstances.get(Input.Keys.F5).transform.setToTranslation(32925.0f, 360.0f, 45588.0f);
  251.         this.ModelInstances.get(Input.Keys.F6).transform.setToTranslation(47295.0f, -540.0f, 4656.0f);
  252.         this.ModelInstances.get(Input.Keys.F7).transform.setToTranslation(27601.0f, 240.0f, 4265.0f);
  253.         this.ModelInstances.get(Input.Keys.F8).transform.setToTranslation(19399.0f, 410.0f, 19812.0f);
  254.         this.ModelInstances.get(Input.Keys.F9).transform.setToTranslation(39730.0f, 550.0f, 56387.0f);
  255.         this.ModelInstances.get(Input.Keys.F10).transform.setToTranslation(53687.0f, 120.0f, -1836.0f);
  256.         this.ModelInstances.get(Input.Keys.F11).transform.setToTranslation(61034.0f, 300.0f, 67142.0f);
  257.         this.ModelInstances.get(Input.Keys.F12).transform.setToTranslation(61519.0f, 460.0f, 38192.0f);
  258.         this.ModelInstances.get(Input.Keys.NUM_LOCK).transform.setToTranslation(30465.0f, 740.0f, 58328.0f);
  259.         this.ModelInstances.get(144).transform.setToTranslation(46585.0f, 300.0f, 1976.0f);
  260.         this.ModelInstances.get(Input.Keys.NUMPAD_1).transform.setToTranslation(27521.0f, -580.0f, 13895.0f);
  261.         this.ModelInstances.get(Input.Keys.NUMPAD_2).transform.setToTranslation(14199.0f, 660.0f, 12782.0f);
  262.         this.ModelInstances.get(Input.Keys.NUMPAD_3).transform.setToTranslation(38590.0f, 80.0f, 61017.0f);
  263.         this.ModelInstances.get(Input.Keys.NUMPAD_4).transform.setToTranslation(56637.0f, -600.0f, 7654.0f);
  264.         this.ModelInstances.get(Input.Keys.NUMPAD_5).transform.setToTranslation(59704.0f, 770.0f, 68842.0f);
  265.         this.ModelInstances.get(Input.Keys.NUMPAD_MULTIPLY).transform.setToTranslation(55349.0f, 0.0f, 36422.0f);
  266.         this.ModelInstances.get(43).transform.setToTranslation(30825.0f, 320.0f, 106268.0f);
  267.         this.ModelInstances.get(44).transform.setToTranslation(53375.0f, 410.0f, 18446.0f);
  268.         this.ModelInstances.get(45).transform.setToTranslation(23801.0f, -300.0f, 71305.0f);
  269.         this.ModelInstances.get(46).transform.setToTranslation(20489.0f, 540.0f, -47528.0f);
  270.         this.ModelInstances.get(47).transform.setToTranslation(36020.0f, 350.0f, 63307.0f);
  271.         this.ModelInstances.get(48).transform.setToTranslation(54657.0f, 500.0f, -8046.0f);
  272.         this.ModelInstances.get(49).transform.setToTranslation(63044.0f, -320.0f, 134442.0f);
  273.         this.ModelInstances.get(50).transform.setToTranslation(63409.0f, -450.0f, -14478.0f);
  274.         this.ModelInstances.get(51).transform.setToTranslation(34945.0f, 770.0f, 114868.0f);
  275.         this.ModelInstances.get(52).transform.setToTranslation(55595.0f, 50.0f, -28854.0f);
  276.         this.ModelInstances.get(53).transform.setToTranslation(15981.0f, -20.0f, -36295.0f);
  277.         this.ModelInstances.get(54).transform.setToTranslation(20329.0f, -400.0f, -11328.0f);
  278.         this.ModelInstances.get(55).transform.setToTranslation(31000.0f, -650.0f, 110507.0f);
  279.         this.ModelInstances.get(56).transform.setToTranslation(43507.0f, -160.0f, -56746.0f);
  280.         this.ModelInstances.get(57).transform.setToTranslation(59404.0f, -30.0f, 37442.0f);
  281.         this.ModelInstances.get(58).transform.setToTranslation(57529.0f, 10.0f, 75622.0f);
  282.         this.ModelInstances.get(59).transform.setToTranslation(27335.0f, 130.0f, 129968.0f);
  283.         this.ModelInstances.get(60).transform.setToTranslation(46965.0f, 540.0f, -27654.0f);
  284.         this.ModelInstances.get(61).transform.setToTranslation(17021.0f, -350.0f, 53605.0f);
  285.         this.ModelInstances.get(62).transform.setToTranslation(15009.0f, 100.0f, -26428.0f);
  286.         this.ModelInstances.get(63).transform.setToTranslation(28140.0f, -50.0f, 53307.0f);
  287.         this.ModelInstances.get(64).transform.setToTranslation(53667.0f, -640.0f, 70554.0f);
  288.         this.ModelInstances.get(Input.Keys.NUMPAD_DIVIDE).transform.setToTranslation(56594.0f, 0.0f, 65842.0f);
  289.         this.ModelInstances.get(65).transform.setToTranslation(50259.0f, -740.0f, 90322.0f);
  290.         this.ModelInstances.get(66).transform.setToTranslation(23545.0f, 30.0f, -164232.0f);
  291.         this.ModelInstances.get(67).transform.setToTranslation(57225.0f, -310.0f, 55046.0f);
  292.         this.ModelInstances.get(68).transform.setToTranslation(22881.0f, -740.0f, -33895.0f);
  293.         this.ModelInstances.get(69).transform.setToTranslation(19739.0f, -60.0f, 24172.0f);
  294.         this.ModelInstances.get(70).transform.setToTranslation(28880.0f, 280.0f, -13493.0f);
  295.         this.ModelInstances.get(71).transform.setToTranslation(51047.0f, -560.0f, -11546.0f);
  296.         this.ModelInstances.get(72).transform.setToTranslation(50614.0f, 390.0f, 139742.0f);
  297.         this.ModelInstances.get(73).transform.setToTranslation(57069.0f, 740.0f, 56022.0f);
  298.         this.ModelInstances.get(Input.Keys.NUMPAD_DOT).transform.setToTranslation(800.0f, 0.0f, 830.0f);
  299.         this.ModelInstances.get(Input.Keys.NUMPAD_COMMA).transform.setToTranslation(500.0f, 0.0f, 120.0f);
  300.         this.ModelInstances.get(160).transform.setToTranslation(250.0f, 0.0f, 370.0f);
  301.         this.ModelInstances.get(Input.Keys.NUMPAD_EQUALS).transform.setToTranslation(-480.0f, 0.0f, 720.0f);
  302.         this.ModelInstances.get(Input.Keys.NUMPAD_LEFT_PAREN).transform.setToTranslation(360.0f, 0.0f, -440.0f);
  303.         this.ModelInstances.get(Input.Keys.NUMPAD_ADD).transform.setToTranslation(560.0f, 0.0f, -690.0f);
  304.         this.ModelInstances.get(Input.Keys.NUMPAD_RIGHT_PAREN).transform.setToTranslation(750.0f, 0.0f, 800.0f);
  305.         this.ModelInstances.get(164).transform.setToTranslation(710.0f, 0.0f, -880.0f);
  306.         this.ModelInstances.get(165).transform.setToTranslation(720.0f, 0.0f, -640.0f);
  307.         this.ModelInstances.get(166).transform.setToTranslation(180.0f, 0.0f, -440.0f);
  308.         this.ModelInstances.get(167).transform.setToTranslation(780.0f, 0.0f, -130.0f);
  309.         this.ModelInstances.get(168).transform.setToTranslation(620.0f, 0.0f, 210.0f);
  310.         this.ModelInstances.get(169).transform.setToTranslation(-740.0f, 0.0f, 230.0f);
  311.         this.ModelInstances.get(170).transform.setToTranslation(-110.0f, 0.0f, -300.0f);
  312.         this.ModelInstances.get(171).transform.setToTranslation(-300.0f, 0.0f, 820.0f);
  313.         this.ModelInstances.get(172).transform.setToTranslation(740.0f, 0.0f, -630.0f);
  314.         this.ModelInstances.get(173).transform.setToTranslation(810.0f, 0.0f, -850.0f);
  315.         this.ModelInstances.get(174).transform.setToTranslation(510.0f, 0.0f, 820.0f);
  316.         this.ModelInstances.get(175).transform.setToTranslation(590.0f, 0.0f, -90.0f);
  317.         this.ModelInstances.get(ContactCallbackEvent.ON_PROCESSED_FILTERED_OBJECT_INCLUDEPOINT).transform.setToTranslation(-590.0f, 0.0f, -580.0f);
  318.         this.ModelInstances.get(177).transform.setToTranslation(-230.0f, 0.0f, -400.0f);
  319.         this.ModelInstances.get(178).transform.setToTranslation(750.0f, 0.0f, -50.0f);
  320.         this.ModelInstances.get(179).transform.setToTranslation(-410.0f, 0.0f, 660.0f);
  321.         this.ModelInstances.get(180).transform.setToTranslation(-780.0f, 0.0f, 210.0f);
  322.         this.ModelInstances.get(Input.Keys.NUMPAD_SUBTRACT).transform.setToTranslation(320.0f, 0.0f, 350.0f);
  323.         this.ModelInstances.get(181).transform.setToTranslation(-40.0f, 0.0f, 140.0f);
  324.         this.ModelInstances.get(182).transform.setToTranslation(570.0f, 0.0f, 330.0f);
  325.         this.ModelInstances.get(Input.Keys.F13).transform.setToTranslation(-210.0f, 0.0f, -520.0f);
  326.         this.ModelInstances.get(Input.Keys.F14).transform.setToTranslation(370.0f, 0.0f, 500.0f);
  327.         this.ModelInstances.get(Input.Keys.F15).transform.setToTranslation(-210.0f, 0.0f, -670.0f);
  328.         this.ModelInstances.get(Input.Keys.F16).transform.setToTranslation(760.0f, 0.0f, -500.0f);
  329.         this.ModelInstances.get(Input.Keys.F17).transform.setToTranslation(-190.0f, 0.0f, 460.0f);
  330.         for (ModelInstance model2 : this.ModelInstances) {
  331.             this.position = new Vector3();
  332.             model2.transform.getTranslation(this.position);
  333.             this.positions.add(this.position);
  334.         }
  335.  
  336.         try {
  337.             // shuffleFlagChars();
  338.         } catch (Exception e) {
  339.             System.out.println(e.getMessage());
  340.         }
  341.     }
  342.  
  343.  
  344.  
  345.     private void teleportToFlag() {
  346.         // Assuming the flag is represented by the first ModelInstance
  347.         if (this.ModelInstances.isEmpty()) return;
  348.  
  349.         ModelInstance flagInstance = this.ModelInstances.get(0); // Adjust index if needed
  350.         Vector3 flagPosition = new Vector3();
  351.         flagInstance.transform.getTranslation(flagPosition);
  352.  
  353.         // Teleport player to the flag's position
  354.         this.playerBody.setWorldTransform(flagInstance.transform);
  355.         this.cam.position.set(flagPosition.x, flagPosition.y + 5.0f, flagPosition.z); // Slight offset above the flag
  356.         this.cam.update();
  357.  
  358.         System.out.println("Teleported to flag at: " + flagPosition);
  359.     }
  360.  
  361.     private void shuffleFlagChars() {
  362.         try {
  363.             float xStart = 0.0f; // Starting position on the X-axis
  364.             float yLevel = 900.0f; // Keep flags higher in the world
  365.             float zStart = 0.0f; // Fixed Z position
  366.             float spacing = 200.0f; // Much more spacing between characters
  367.             float xPosition = xStart; // Initial X position for the first flag
  368.  
  369.             for (int i = 0; i < 187; i++) {
  370.                 ModelInstance model = this.ModelInstances.get(i);
  371.  
  372.                     // Set each flag in a long row, spaced apart
  373.                 model.transform.setToTranslation(xPosition, yLevel, zStart);
  374.  
  375.                 // Store updated position
  376.                 Vector3 newPosition = new Vector3();
  377.                 model.transform.getTranslation(newPosition);
  378.                 this.positions.set(i, newPosition);
  379.  
  380.                 // Move the X position for the next flag
  381.                 xPosition += spacing;
  382.             }
  383.         } catch (Exception e) {
  384.             System.out.println("Error arranging flag characters in row: " + e.getMessage());
  385.         }
  386.     }
  387.  
  388.     private void createUI() {
  389.         // Create buttons or touch zones for each model.
  390.         // For simplicity, let's just create a button that cycles through the model list.
  391.  
  392.         // Create an input listener for selecting models via touch
  393.         Gdx.input.setInputProcessor(new InputAdapter() {
  394.             @Override
  395.             public boolean touchDown(int screenX, int screenY, int pointer, int button) {
  396.                 if (screenX > 100 && screenX < 200 && screenY > 100 && screenY < 200) {
  397.                     // Cycle through models on touch
  398.                     selectedModelIndex = (selectedModelIndex + 1) % modelInstances.size();
  399.                     return true;
  400.                 }
  401.                 return false;
  402.             }
  403.         });
  404.     }
  405.  
  406.  
  407.     public List<int[]> repeatList(List<int[]> offsets, int targetLength) {
  408.         this.repeatedList = new ArrayList();
  409.         while (this.repeatedList.size() < targetLength) {
  410.             for (int[] offset : offsets) {
  411.                 if (this.repeatedList.size() < targetLength) {
  412.                     this.repeatedList.add(offset);
  413.                 }
  414.             }
  415.         }
  416.         return this.repeatedList;
  417.     }
  418.  
  419.     public List<int[]> generateOffsets(String hash) {
  420.         List<int[]> offsets = new ArrayList<>();
  421.         for (int i = 0; i < hash.length(); i += 8) {
  422.             int xOffset = Integer.parseInt(hash.substring(i, i + 4), 16);
  423.             int zOffset = Integer.parseInt(hash.substring(i + 4, i + 8), 16);
  424.             offsets.add(new int[]{xOffset, zOffset});
  425.         }
  426.         return offsets;
  427.     }
  428.  
  429.     public String toHexString(byte[] hash) {
  430.         BigInteger number = new BigInteger(1, hash);
  431.         StringBuilder hexString = new StringBuilder(number.toString(16));
  432.         while (hexString.length() < 64) {
  433.             hexString.insert(0, '0');
  434.         }
  435.         return hexString.toString();
  436.     }
  437.  
  438.     private void setupPhysicsWorld() {
  439.         this.collisionConfig = new btDefaultCollisionConfiguration();
  440.         this.dispatcher = new btCollisionDispatcher(this.collisionConfig);
  441.         this.broadphase = new btDbvtBroadphase();
  442.         this.dynamicsWorld = new btDiscreteDynamicsWorld(this.dispatcher, this.broadphase, null, this.collisionConfig);
  443.         this.dynamicsWorld.setGravity(new Vector3(0.0f, -50.0f, 0.0f));
  444.         createEnvironmentBodies();
  445.         createPlayerBody();
  446.     }
  447.  
  448.     private void createEnvironmentBodies() {
  449.         ModelBuilder modelBuilder = new ModelBuilder();
  450.         this.floorModel = modelBuilder.createBox(2000.0f, 1.0f, 2000.0f, new Material(ColorAttribute.createDiffuse(Color.GRAY)), 9L);
  451.         this.floorInstance = new ModelInstance(this.floorModel);
  452.         this.floorInstance.transform.setToTranslation(0.0f, -0.5f, 0.0f);
  453.         btCollisionShape floorShape = new btBoxShape(new Vector3(1000.0f, 0.5f, 1000.0f));
  454.         btRigidBody floorBody = createStaticBody(floorShape, this.floorInstance.transform);
  455.         this.environmentBodies.add(floorBody);
  456.         this.frontWallModel = modelBuilder.createBox(2000.0f, 500.0f, 10.0f, new Material(ColorAttribute.createDiffuse(Color.valueOf("#e4e6a8"))), 9L);
  457.         this.frontWallInstance = new ModelInstance(this.frontWallModel);
  458.         this.frontWallInstance.transform.setToTranslation(0.0f, 250.0f, 1000.0f);
  459.         btCollisionShape frontWallShape = new btBoxShape(new Vector3(1000.0f, 250.0f, 10.0f / 2.0f));
  460.         btRigidBody frontWallBody = createStaticBody(frontWallShape, this.frontWallInstance.transform);
  461.         this.environmentBodies.add(frontWallBody);
  462.         this.backWallModel = modelBuilder.createBox(2000.0f, 500.0f, 10.0f, new Material(ColorAttribute.createDiffuse(Color.valueOf("#e4e6a8"))), 9L);
  463.         this.backWallInstance = new ModelInstance(this.backWallModel);
  464.         this.backWallInstance.transform.setToTranslation(0.0f, 250.0f, -1000.0f);
  465.         btCollisionShape backWallShape = new btBoxShape(new Vector3(1000.0f, 250.0f, 10.0f / 2.0f));
  466.         btRigidBody backWallBody = createStaticBody(backWallShape, this.backWallInstance.transform);
  467.         this.environmentBodies.add(backWallBody);
  468.         this.leftWallModel = modelBuilder.createBox(10.0f, 500.0f, 2000.0f, new Material(ColorAttribute.createDiffuse(Color.valueOf("#e4e6a8"))), 9L);
  469.         this.leftWallInstance = new ModelInstance(this.leftWallModel);
  470.         this.leftWallInstance.transform.setToTranslation(-1000.0f, 250.0f, 0.0f);
  471.         btCollisionShape leftWallShape = new btBoxShape(new Vector3(10.0f / 2.0f, 250.0f, 1000.0f));
  472.         btRigidBody leftWallBody = createStaticBody(leftWallShape, this.leftWallInstance.transform);
  473.         this.environmentBodies.add(leftWallBody);
  474.         this.rightWallModel = modelBuilder.createBox(10.0f, 500.0f, 2000.0f, new Material(ColorAttribute.createDiffuse(Color.valueOf("#e4e6a8"))), 9L);
  475.         this.rightWallInstance = new ModelInstance(this.rightWallModel);
  476.         this.rightWallInstance.transform.setToTranslation(1000.0f, 250.0f, 0.0f);
  477.         btCollisionShape rightWallShape = new btBoxShape(new Vector3(10.0f / 2.0f, 250.0f, 1000.0f));
  478.         btRigidBody rightWallBody = createStaticBody(rightWallShape, this.rightWallInstance.transform);
  479.         this.environmentBodies.add(rightWallBody);
  480.     }
  481.  
  482.     private void createPlayerBody() {
  483.         ModelBuilder modelBuilder = new ModelBuilder();
  484.         this.playerModel = modelBuilder.createBox(10.0f, 30.0f, 10.0f, new Material(ColorAttribute.createDiffuse(Color.BLUE)), 9L);
  485.         this.playerInstance = new ModelInstance(this.playerModel);
  486.         this.playerShape = new btBoxShape(new Vector3(5.0f, 15.0f, 5.0f));
  487.         btDefaultMotionState motionState = new btDefaultMotionState(this.playerInstance.transform);
  488.         btRigidBody.btRigidBodyConstructionInfo bodyInfo = new btRigidBody.btRigidBodyConstructionInfo(1.0f, motionState, this.playerShape, new Vector3(0.0f, 5.0f, 0.0f));
  489.         this.playerBody = new btRigidBody(bodyInfo);
  490.         this.playerBody.setAngularFactor(Vector3.Zero);
  491.         this.playerBody.setActivationState(4);
  492.         this.dynamicsWorld.addRigidBody(this.playerBody);
  493.         this.playerBody.setAngularFactor(new Vector3(0.0f, 0.0f, 0.0f));
  494.         this.playerBody.setActivationState(4);
  495.         this.playerBody.setWorldTransform(this.playerInstance.transform);
  496.         teleportToFlag();
  497.         this.dynamicsWorld.addRigidBody(this.playerBody);
  498.     }
  499.  
  500.     private void drawButtons() {
  501.         shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
  502.  
  503.         // Movement and camera buttons (existing buttons remain unchanged)
  504.         shapeRenderer.setColor(Color.BLUE);
  505.         shapeRenderer.rect(0, 200, 50, 50); // Rotate left
  506.         shapeRenderer.rect(100, 200, 50, 50); // Rotate right
  507.         shapeRenderer.setColor(Color.CYAN);
  508.         shapeRenderer.rect(50, 250, 50, 50); // Look up
  509.         shapeRenderer.rect(50, 150, 50, 50); // Look down
  510.         shapeRenderer.setColor(Color.GREEN);
  511.         shapeRenderer.rect(50, 200, 50, 50); // Forward
  512.         shapeRenderer.rect(50, 100, 50, 50); // Backward
  513.         shapeRenderer.setColor(Color.YELLOW);
  514.         shapeRenderer.rect(0, 150, 50, 50); // Strafe left
  515.         shapeRenderer.rect(100, 150, 50, 50); // Strafe right
  516.         shapeRenderer.setColor(Color.MAGENTA);
  517.         shapeRenderer.rect(200, 200, 50, 50); // Ascend
  518.         shapeRenderer.rect(200, 150, 50, 50); // Descend
  519.  
  520.         // Freeze and teleport buttons
  521.         shapeRenderer.setColor(Color.RED);
  522.         shapeRenderer.rect(300, 200, 50, 50); // Freeze button
  523.         shapeRenderer.setColor(Color.ORANGE);
  524.         shapeRenderer.rect(300, 150, 50, 50); // Teleport button
  525.  
  526.         shapeRenderer.end();
  527.     }
  528.  
  529.  
  530.  
  531.  
  532.     private btRigidBody createStaticBody(btCollisionShape shape, Matrix4 transform) {
  533.         btRigidBody.btRigidBodyConstructionInfo bodyConstructionInfo = new btRigidBody.btRigidBodyConstructionInfo(0.0f, (btMotionState) null, shape, Vector3.Zero);
  534.         btRigidBody body = new btRigidBody(bodyConstructionInfo);
  535.         body.setWorldTransform(transform);
  536.         this.dynamicsWorld.addRigidBody(body);
  537.         return body;
  538.     }
  539.  
  540.     @Override // com.badlogic.gdx.ApplicationAdapter, com.badlogic.gdx.ApplicationListener
  541.     public void render() {
  542.         Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  543.         Gdx.gl.glClear(16640);
  544.         this.dynamicsWorld.stepSimulation(Gdx.graphics.getDeltaTime(), 5, 0.016666668f);
  545.         Matrix4 playerTransform = new Matrix4();
  546.         this.playerBody.getWorldTransform(playerTransform);
  547.         this.playerInstance.transform.set(playerTransform);
  548.         this.cam.position.set(this.playerBody.getCenterOfMassPosition().x, this.playerBody.getCenterOfMassPosition().y + 5.0f, this.playerBody.getCenterOfMassPosition().z);
  549.         this.cam.update();
  550.         handlePlayerMovement();
  551.         this.modelBatch.begin(this.cam);
  552.         this.modelBatch.render(this.floorInstance, this.environment);
  553.         this.modelBatch.render(this.frontWallInstance, this.environment);
  554.         this.modelBatch.render(this.backWallInstance, this.environment);
  555.         this.modelBatch.render(this.leftWallInstance, this.environment);
  556.         this.modelBatch.render(this.rightWallInstance, this.environment);
  557.         this.modelBatch.render(this.playerInstance, this.environment);
  558.         for (ModelInstance alphabetInstance : this.ModelInstances) {
  559.             this.modelBatch.render(alphabetInstance, this.environment);
  560.         }
  561.         this.modelBatch.end();
  562.         drawButtons();
  563.         // this.jumpscareTimer += Gdx.graphics.getDeltaTime();
  564.         if (this.jumpscareTimer >= this.JUMPSCARE_INTERVAL && !this.jumpscareTriggered) {
  565.             try {
  566.                 triggerJumpscare();
  567.             } catch (Exception e) {
  568.                 System.out.println(e.getMessage());
  569.             }
  570.         }
  571.         if (this.jumpscareTimer >= this.SCARE_INTERVAL && !this.scareTriggered) {
  572.             this.scareSound.play(0.5f);
  573.             this.scareTriggered = true;
  574.         }
  575.         if (this.jumpscareTriggered) {
  576.             this.spriteBatch.begin();
  577.             this.spriteBatch.draw(this.jumpscareImage, 0.0f, 0.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  578.             this.spriteBatch.end();
  579.             if (this.jumpscareTimer >= this.JUMPSCARE_INTERVAL + 2.0f) {
  580.                 Gdx.app.exit();
  581.             }
  582.         }
  583.     }
  584.  
  585.     public void triggerJumpscare() throws NoSuchAlgorithmException {
  586.         this.jumpscareTriggered = true;
  587.         this.jumpscareSound.play();
  588.     }
  589.  
  590.     private void handlePlayerMovement() {
  591.         Vector3 movement = new Vector3();
  592.  
  593.         // Touch-based input handling
  594.         if (Gdx.input.isTouched()) {
  595.             int screenX = Gdx.input.getX();
  596.             int screenY = Gdx.graphics.getHeight() - Gdx.input.getY();
  597.  
  598.             // Toggle freeze
  599.             if (screenX >= 300 && screenX <= 350 && screenY >= 200 && screenY <= 250) {
  600.                 this.playerBody.setLinearVelocity(Vector3.Zero);
  601.                 this.playerBody.setGravity(Vector3.Zero); // Disable gravity
  602.                 return; // Skip further movement when frozen
  603.             }
  604.  
  605.             // Rotate camera horizontally (left/right)
  606.             if (screenX >= 0 && screenX <= 50 && screenY >= 200 && screenY <= 250) {
  607.                 this.cam.rotate(Vector3.Y, 2.5f); // Rotate left
  608.                 this.cam.update();
  609.             } else if (screenX >= 100 && screenX <= 150 && screenY >= 200 && screenY <= 250) {
  610.                 this.cam.rotate(Vector3.Y, -2.5f); // Rotate right
  611.                 this.cam.update();
  612.             }
  613.  
  614.             // Rotate camera vertically (look up/down)
  615.             else if (screenX >= 50 && screenX <= 100 && screenY >= 250 && screenY <= 300) {
  616.                 Vector3 right = new Vector3(this.cam.direction).crs(this.cam.up).nor(); // Camera's right vector
  617.                 this.cam.direction.rotate(right, 2.5f); // Look up
  618.                 this.cam.update();
  619.             } else if (screenX >= 50 && screenX <= 100 && screenY >= 150 && screenY <= 200) {
  620.                 Vector3 right = new Vector3(this.cam.direction).crs(this.cam.up).nor(); // Camera's right vector
  621.                 this.cam.direction.rotate(right, -2.5f); // Look down
  622.                 this.cam.update();
  623.             }
  624.  
  625.             // Move forward/backward
  626.             else if (screenX >= 50 && screenX <= 100 && screenY >= 200 && screenY <= 250) {
  627.                 movement.set(this.cam.direction.x, 0.0f, this.cam.direction.z).nor().scl(this.movementSpeed); // Forward
  628.             } else if (screenX >= 50 && screenX <= 100 && screenY >= 100 && screenY <= 150) {
  629.                 movement.set(this.cam.direction.x, 0.0f, this.cam.direction.z).nor().scl(-this.movementSpeed); // Backward
  630.             }
  631.  
  632.             // Strafe left/right
  633.             else if (screenX >= 0 && screenX <= 50 && screenY >= 150 && screenY <= 200) {
  634.                 Vector3 left = new Vector3(this.cam.direction).crs(this.cam.up).nor();
  635.                 movement.set(left.x, 0.0f, left.z).scl(-this.movementSpeed); // Strafe left
  636.             } else if (screenX >= 100 && screenX <= 150 && screenY >= 150 && screenY <= 200) {
  637.                 Vector3 right = new Vector3(this.cam.direction).crs(this.cam.up).nor();
  638.                 movement.set(right.x, 0.0f, right.z).scl(this.movementSpeed); // Strafe right
  639.             }
  640.  
  641.             // Move up/down
  642.             else if (screenX >= 200 && screenX <= 250 && screenY >= 200 && screenY <= 250) {
  643.                 movement.set(0.0f, this.movementSpeed, 0.0f); // Ascend
  644.                 this.playerBody.setGravity(Vector3.Zero); // Temporarily disable gravity
  645.             } else if (screenX >= 200 && screenX <= 250 && screenY >= 150 && screenY <= 200) {
  646.                 movement.set(0.0f, -this.movementSpeed, 0.0f); // Descend
  647.                 this.playerBody.setGravity(Vector3.Zero); // Temporarily disable gravity
  648.             } else {
  649.                 this.playerBody.setGravity(new Vector3(0.0f, -50.0f, 0.0f)); // Restore gravity
  650.             }
  651.         }
  652.  
  653.         // Apply movement to the player body
  654.         if (!movement.isZero()) {
  655.             this.playerBody.applyCentralImpulse(movement);
  656.  
  657.             // Limit maximum velocity
  658.             Vector3 velocity = this.playerBody.getLinearVelocity();
  659.             if (velocity.len() > 2000.0f) {
  660.                 velocity.nor().scl(2000.0f);
  661.                 this.playerBody.setLinearVelocity(velocity);
  662.             }
  663.         }
  664.     }
  665.  
  666.  
  667.  
  668.  
  669.  
  670.     @Override // com.badlogic.gdx.ApplicationAdapter, com.badlogic.gdx.ApplicationListener
  671.     public void dispose() {
  672.         for (btRigidBody body : this.environmentBodies) {
  673.             body.dispose();
  674.         }
  675.         this.playerBody.dispose();
  676.         this.playerShape.dispose();
  677.         this.dynamicsWorld.dispose();
  678.         this.dispatcher.dispose();
  679.         this.broadphase.dispose();
  680.         this.collisionConfig.dispose();
  681.         this.dispatcher.dispose();
  682.         this.collisionConfig.dispose();
  683.         this.modelBatch.dispose();
  684.         this.floorModel.dispose();
  685.         this.wallModel.dispose();
  686.         this.leftWallModel.dispose();
  687.         this.rightWallModel.dispose();
  688.         this.backWallModel.dispose();
  689.         this.frontWallModel.dispose();
  690.         for (Model model : this.Models) {
  691.             model.dispose();
  692.         }
  693.         if (this.assetManager != null) {
  694.             this.assetManager.dispose();
  695.         }
  696.         if (this.jumpscareImage != null) {
  697.             this.jumpscareImage.dispose();
  698.         }
  699.         if (this.jumpscareSound != null) {
  700.             this.jumpscareSound.dispose();
  701.         }
  702.         if (this.scareSound != null) {
  703.             this.scareSound.dispose();
  704.         }
  705.         if (this.spriteBatch != null) {
  706.             this.spriteBatch.dispose();
  707.         }
  708.         if (this.backgroundMusic != null) {
  709.             this.backgroundMusic.dispose();
  710.         }
  711.     }
  712. }
  713.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement