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

Spacing between letters is reduced if I use GlyphLayout to draw a bitmap font

I need to use glyphlayout so that I can centre the text, but I found if I do the text gets distorted due to the spacing being incorrect. public SimpleButton(String text, float x, float y, float w, float h, BitmapFont font) { pos = new Vector2(x, y); this.w = w; this.h = h; this.text = […]

Categories
Game Creation Mastering Development

Spacing between letters is reduced if I use GlyphLayout to draw a bitmap font

I need to use glyphlayout so that I can centre the text, but I found if I do the text gets distorted due to the spacing being incorrect. public SimpleButton(String text, float x, float y, float w, float h, BitmapFont font) { pos = new Vector2(x, y); this.w = w; this.h = h; this.text = […]

Categories
Game Creation Mastering Development

Spacing between letters is reduced if I use GlyphLayout to draw a bitmap font

I need to use glyphlayout so that I can centre the text, but I found if I do the text gets distorted due to the spacing being incorrect. public SimpleButton(String text, float x, float y, float w, float h, BitmapFont font) { pos = new Vector2(x, y); this.w = w; this.h = h; this.text = […]

Categories
Mastering Development

How to change the health of an enemy during runtime?

I have created the enemy “Fly” that starts with 2 health. If it gets hit by a bullet I want the health of the specific Fly to change to 1, the next time to 0 etc. I know how to give Fly an initial health value, but not how to change it while the game […]

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
Mastering Development

How to detect collisions between objects in LibGDX

This is my first post on stack overflow so I apologize in advance if I’m breaking any rules about posting, etc. I have been working on a an asteroids-esque shooting game and I can’t figure out how to get the collision detection working between the rocks and the laser. The source code can be found […]

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

Box2d: crash on createBody in beginContact callback

I am getting this error on creating body in contactListener com.patchnhack.gdx A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x58 in tid 4628 (GLThread 15500), pid 4583 I am creating a body in beginContact callback like this: …… public void beginContact(Contact contact) { ….. ….. createBody(0,0); …. …. } // createbody method in screen […]

Categories
Development Game Creation

Vector

I am learning about when to use pointers and references in c++ with SFML. I am making a simple scrolling star field using vertices directly and random colors. It works pretty well so far. The main reason I make this is to work with std::vector<> and std::unique_ptr to learn it. Of course I need to […]