Hot answers tagged

9

A simple way to achieve smooth lighting in a tile based game, is to draw a "lightmap" to a render target, and then drawing this render target over top your scene while alpha blending it. Your light map render target would be the size of your tile map, but in pixels. Each pixel would represent the light color of its corresponding tile. This render texture ...


4

an engine agnostic way to do it is to use average light mapping. First, you need to generate a black and white map as a 2D array of booleans that is the size of the world where the blocks are True and empty is False. Like This(1 is black, 0 is white): Then you need to create a new 2D array that is the same size as the first array but is an array of ...


2

The character should have a single state machine. Animations should be controlled by the character state so they don't need their own character-specific state machine except as part of a generic animation system. Status variables (health, ammo, invincibility timer, inventory, etc) are part of deciding which state to transition to but not state machines in ...


2

The relationship between the Gun and the Bullet is purely 'spawner/spawned'. It's not parent-child. In real-life, when you shoot a bullet with a gun, both objects are no longer linked: you can move the gun as you want, once the bullet is out of the barrel, there's nothing you can do to change its trajectory. So in your case, you should make the bullet as ...


1

Since you are talking about things blocking light, I'm assuming you have some model for how light should spread. For example everything with no blocks above it is completely lit, light spreads to all neighbouring cells but loses a certain amount of brightness. You should be able to implement those rules fairly easily on the software side at least the ...


1

First tip, don't use a linked list. At least not in this way. Use an ArrayList instead. If you absolutely have to use a linked list use an iterator. Secondly it's probably a good idea to cull stuff on your screen. That should get you going for a while. Although I am willing to bet there are performance issues elsewhere as well.


1

From the libGDX github wiki: Note: By default, the Json class will not write those fields which have values that are identical to a newly constructed instance. If you wish to disable this behavior and include all fields, call json.setUsePrototypes(false);.



Only top voted, non community-wiki answers of a minimum length are eligible