Tag Info

New answers tagged

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.


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 ...


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 ...


0

You're not even using the y coordinate when you're storing your tiles. You're just using x and some random value: `( Sprite.dirtTile,x,RandomHeight)'. Which likely means you'll have tiles stacked on top of each other, meaning your list is going to contain some tiles that are occupying the same position. However, the naive approach to finding the tile at a ...


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 ...


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 ...


0

Treat the tilemap as purely graphical data, and use some other structure to resolve collisions. In your case, you can define the boundaries of your roads using edges (segments). You have a vector (line) representing the player's movement, and you want to know if this line will intersect some wall during this timestep. Since these walls are represented by ...


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 ...


0

I don't think speed is a huge issue between your different methods so you might go with whichever approach you think is easiest. I would absolutely choose to access the arrays differently and not store pre-rotated versions of them. For rotating one chunk: normal rotation gives you array[x][y] -90 degrees would give you array[WIDTH-1-y][x] 180 degrees would ...



Top 50 recent answers are included