Tag Info

Hot answers tagged

2

Several possibilities : 1) use small collision maps for each different tile. It does not need to be very precise, small maps like 8x8 might be enough (depending what you need). You can do some interpolation to smooth it out. Here is an example : Instead of using only occupied / non-occupied state for the collision map, you might also consider using ...


2

One thing I've done in the past for island shapes is to use perlin noise minus a circular shape. It usually produces one big island and some little things off on the side. You can use flood fill or smoothing to remove any small noise. Here's a demo (flash) that I wrote for this question. For each location (x, y) in the noise bitmap, compute the distance ...


2

It's quite simple. Just divide your position with tile dimensions. Like this. tileX = positionX / tileWidth tileY = positionY / tileHeight this will give you x and y tile, where your position is. This assumes that your top left tile is at 0,0 coordinates. So, in your case, lets say coordinates are x:256,y:172 tileX = x / 50 tileY = y / 50 This would ...


2

That's purely a matter of personal preference. Unless you are going to extremes of some sort (too small or too large), that aspect alone won't affect performance. Of course if you have same count of tiles, larger images will naturally consume more memory and, generally, perform slower. As a side note, assuming you are beginner in a gamedev, most ...


1

Its really a matter of how much definition you want in your map... If you choose 32x32 px you'll mostly end up with Pixel Art. If that is not what you are looking for, just pick a bigger size. As long as it is a power of 2 and its not an absurd HD size just for one tile, it wont really affect performance.


1

Collision doesn't need to care about tiles at all. If a tile is just a shape of lines, your "tile collision" is really just collision against those specific lines. You can also use collision against arbitrary shapes defined by mathematical functions - like curves - which are represented by tiles. Tile collision in this case means determining which tiles the ...


1

Essentially a series of flood fills - one for each cell in the grid, but skipping over any you've already visited, and dropping out early if you find a cell not connected to a group you've already flood-filled/gathered but of the same type as that group. Written blind, so please excuse any code typos or holes; highlight them in a comment and I will amend. ...


1

The way I might approach it is to create a list of all possible hex center locations during the initialization stage before the game loop starts. Then during the game loop, if there is a mouse click within 1.5 tile radius (or whatever dist you think is approp) of a white tile, simply iterate the list and find the closest list Point to the click point. If the ...



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