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

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

scrolling background in game android studio.Background moves towards right with screen blinking how to solve it

I want to implement a scrolling background in my game in android studio. My idea was to have two Bitmaps, who are drawn next to each other and to reset the position of a bitmap if it is not the screen anymore The background moves right the screen is blinking How can I solve my […]

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 […]

Categories
Development

Android application in Android Studio running and working fully on a Android Studio Emulator, but crashing on a physical device

Can you guys help me with my problem? My program is running with no problems on Android Studio Emulator (Pixel 2 API 28), but after I install it on my phone (Samsung Galaxy S8+ API 28), it just keep on crashing every time i tap the play button :(. I also tried it on some […]