Tag Info

New answers tagged

0

Having a list of textures in an array is not a great idea. What if you decide to put them into a texture atlas later (which is generally more efficient than loading a bunch of files)? What if you change the order of a file in the middle? You'll have to re-order a bunch of your data. A more flexible approach would be to keep not just a flat file name or ...


1

You can initialize tile1, tile2 and tile3 and then you can add them to Array. tile1 = new Texture(Gdx.files.internal("grass.png")); tile2 = new Texture(Gdx.files.internal("dirttile.png")); tile3 = new Texture(Gdx.files.internal("watertile.png")); Here is how you will initialize Array: Texture[] tile = {tile1, tile2, tile3};


0

Short answer: Depends on size and type of world/map, but when in doubt use an tile based solution using an array. You might benefit from creating your map as 2D jigzaw, where you load only the relevant pieces you actually need to show on screen. The simplest way to do this is to treat your map as made up of tiles, as is done in any kind of old scool ...


0

I asked a somewhat different question, but the problem is pretty much the same. The following link will give you an idea what you will encounter, and hopefully helps you on your way, like it helped me. http://floatingorigin.com/mirror/continuous-world.htm


1

Simply use shapes and AABB collisions. Keep a tiled map. Create an approximation of a circle using tiles and create a rectangle for each of the unwalkable tiles. Next, when you create a player or any movable entity, simply create a Rectangle around them too. Before moving, look whether or not the player's rectangle would collide with any of the wall's ...


1

I'm assuming you're either using some sort of entity-component system, or else you have in-game classes that represent your objects. Either way, you have some reference to your in-game objects (players, walls, enemies, etc.) At a minimum, these objects should have: A position A sprite (display) A collision primitive (axis-aligned bounding box?) All you ...


0

You can use a raycasting (or linecasting) based collision detection system. At a very high level, you cast rays from your player (preferably from the edges of it's collider box) into the game map. When the ray hits something, you can check to see what its hit, and if it's a collidable surface, resolve the collision and adjust player movement as appropriate. ...


1

If changes happen in an area, then you only need to update that area (rather than updating the entire map.) You could divide the array into an 80x60 array (I'll call them 'chunks'), each with 10x10x3, sections. With some basic data on who owns each larger section. So if the raising/lowering only happens in adjacent fields, and you know that all chunks ...


3

You absolutely can combine them! Many 3D games contain an image for the characters body and one for the head, and some combine the two for a single texture for the entire a model. Here's an example of a whole head's texture: Also check out this PDF if you'd like to learn more about texture mapping in general.



Top 50 recent answers are included