Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

556 Good

About stein102

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Added you on discord. I may be interested in a java dev position.
  2. I'm trying to render a player texture on top of a TiledMap in LibGDX, my issue is that the map renders correctly, but the player texture is way larger than it should be. I'm sure it has something to do with my lack of understanding of the camera/viewport system, but I can't quite figure it out. game.unitsPerTile = 32 in this case. The texture in question is 32x64. public class GameScreen implements Screen { final Engine2D game; private OrthographicCamera camera; static final int GAME_WIDTH = 100; static final int GAME_HEIGHT = 100; private TiledMap map; private OrthogonalTiledMapRenderer mapRenderer; private Player player; public GameScreen(Engine2D game) { this.game = game; float screenWidth = Gdx.graphics.getWidth(); float screenHeight = Gdx.graphics.getHeight(); float aspectRatio = screenHeight/screenWidth; camera = new OrthographicCamera(30,30*aspectRatio); map = new TmxMapLoader().load("Map1.tmx"); mapRenderer = new OrthogonalTiledMapRenderer(map,1/game.unitsPerTile); TiledMapTileMapObject startPoint = (TiledMapTileMapObject)map.getLayers().get("Objects").getObjects().get("startZone"); player = new Player(); player.setPositionX(startPoint.getX()/game.unitsPerTile); player.setPositionY(startPoint.getY()/game.unitsPerTile); } @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); game.batch.setProjectionMatrix(camera.combined); camera.position.x = player.getPositionX() + camera.viewportWidth/2; camera.position.y = player.getPositionY() + camera.viewportHeight/2; // tell the camera to update its matrices. camera.update(); mapRenderer.render(); mapRenderer.setView(camera); // begin a new batch and draw the bucket and // all drops game.batch.begin(); game.batch.draw(player.getTexture(),player.getPositionX(),player.getPositionY()); game.batch.end(); } }
  3. stein102

    A Verlet based approach for 2D game physics

    To add friction, you would need to know the mass of the object, but it would look something like this.   FrictionVector = ?*m*g;   Where: ? = coefficient of friction between two objects(higher number means more friction) m = mass g = gravitational constant (9.8 on earth)   The direction would be in the opposite direction of the force applied.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!