Categories
Game Creation Mastering Development

How to add sprite batch on tile in isometric map in Libgdx

I’m using Libgdx to create an isometric game , but now I have problem. I want to add sprite on tile (3,4) , but I can’t do this, so I searched on stackoverflow , and I found this code :- public Vector2 twoDToIso(Vector2 punto) { Vector2 tempP = new Vector2(0, 0); tempP.x = (punto.x – […]

Categories
Game Creation Mastering Development

Casting the InputMultiplex class

public abstract class BaseScreen implements Screen,InputProcessor { SpriteBatch batch; //stage principal protected Table uiTable; protected String screenAnterior; protected Stage mainStage; protected Stage uiStage; public BaseScreen() { batch=new SpriteBatch(); int vpwidth=Gdx.graphics.getWidth(); int vpheight=Gdx.graphics.getHeight(); mainStage = new Stage(); uiStage = new Stage(); Gdx.input.setInputProcessor(mainStage); uiTable = new Table(); uiTable.setFillParent(true); uiStage.addActor(uiTable); initialize(); } public abstract void initialize(); public abstract […]

Categories
Game Creation Mastering Development

Libgdx, size of the button on phone really small

I making a game, so I created main menu with scene2d,on PC my menu looks good (big buttons on the center of the screen), on my phone it looks very small, what should I change? If you see any code I don’t need, please point me out, THANK YOU!!! public class MenuState extends State { […]

Categories
Game Creation Mastering Development

Connect 4 game switch player on dropping the chip

I am writing connect 4 game with 7*6 board in Libgdx for android and want player2 to wait for player1 chip to reach down before playing his move. My Dropping piece code is: Gdx.input.setInputProcessor(adapter = new InputAdapter(){ @Override public boolean touchUp(int screenX, int screenY, int pointer, int btn) { // check for valid move if(chips.get(chipIndex+3).size()<6) […]

Categories
Development

Mouse click detection

I think i just need a little bit of correction on my code, but I can’t figure out what im missing. Using input processor on Libgdx. I want to add a new piece of food to an arraylist and draw it to the screen at the position of the mouse, but it does not draw. […]

Categories
Development

How to rotate Perspective Camera in 3D Libgdx

I’m creating 3d game with libgdx but I have problem, I want to rotate the camera on touch the screen , so I added this from libgdx wiki @Override public boolean touchDragged (int screenX, int screenY, int pointer) { float deltaX = -Gdx.input.getDeltaX() * degreesPerPixel; float deltaY = -Gdx.input.getDeltaY() * degreesPerPixel; camera.rotate(Vector3.Y,deltaX*0.9f); camera.rotate(Vector3.X,360-deltaY*0.9f); camera.update(); return […]