tile

Getting a top-left position of a tile inside a tileset

徘徊边缘 提交于 2019-12-11 10:27:31
问题 I have a tileset(a image full of other small images). And I wanna get one of those little images called tile so I can do something with it. I know the size of each tile(they're all the same size). I have two equations: x = (i % tiles_hor) * tile_h y = (i % tiles_ver) * tile_w x = (i % tiles_hor) * tile_w y = (i / tiles_hor) * tile_w where i means the index of the tile i wanna get; tiles_hor is the number of tiles horizontally; tiles_ver is the number of tiles vertically; tile_w and tile_h is

Using tiles in SFML and collision detection

匆匆过客 提交于 2019-12-11 08:17:30
问题 I decided to look a good tileset to use and found some, but the question is how I actually load the tile from the image file as there seem to be more than one tile in one file? Also how do I implement a collision detection for non square tiles? Example: Tileset 回答1: Images(sfml1.6) or Textures (sfml2.0) are usually drawn using sf::Sprite . The usual way to do it is to let all sprites share the same tileset texture/image, and then use sf::Sprite::SetSubRect(const IntRect &SubRect) to set the

Tilemap Collision SFML C++

好久不见. 提交于 2019-12-11 06:58:46
问题 I've spent many frustrating hours and cannot figure this out, i understand collision and have it working until i try to implement gravity, i cant seem to set the player position after it hits the tile map, falling through the ground is my problem, x axis a variation of the following code works fine if (background.colMap[tiles[i].y][tiles[i].x] == 1) { playerSpeed.y = -0.f; playerSprite.setPosition(playerSprite.getPosition().x, playerSprite.getPosition().y - 1); inAir = false; } I though by

Having issues with creating Tile Sets in Xcode 8. Anyone have any success?

风格不统一 提交于 2019-12-10 22:57:59
问题 Been trying to create a tile set to use in the new scene editor in the Xcode 8 beta. But, I drag a image in there from the asset catalog and I click away and it's as if I never placed a texture in there. I can't figure out how to get the tiles to save the image data. Before: After I click away to any other file then click back: Then the Scene Editor won't let me select a tile to use to draw. Anyone had any luck saving image data in a tile and using it? Any workarounds? Anyone able to upload

PyGame: Panning tiled map causes gaps

泄露秘密 提交于 2019-12-10 17:51:46
问题 I'm using PyGame 1.9.2 on Python 3.4.3 (Win8.1). My game window consists of a tiled map using 48x48px tiles. The game's framework moves the tiles according to player input using the following method of the game's framwork class: def moveTiles(self): xmove = self.parent.dt * self.panning[0] * self.panning_speed ymove = self.parent.dt * self.panning[1] * self.panning_speed for tile in self.game_map: tile.x += xmove tile.y += ymove tile.rect.x = int(tile.x) tile.rect.y = int(tile.y) tile.pos =

UWP Tile Background Color Not Working

别等时光非礼了梦想. 提交于 2019-12-10 15:53:56
问题 I set the background color in the app manifest to black but the tile still shows blue in the app list and transparent when pinned to the start screen. The tile color is changed in the IDE (VS) but not when I run it in the phone emulator. There is a similar question and answer: Windows 8 Live Tile Icon Background Color, but it is specifically for Windows 8 and actually says you can set it to anything which is not true as I found out. 回答1: The problem is the value must be a hex value, which is

Tiled Map Editor: size of isometric tile side

我的未来我决定 提交于 2019-12-09 19:58:20
问题 In Tiled editor there is an isometric map example: "isometric_grass_and_water.tmx". This example shows simple isometric map with tiles which have size 64x32 pixels. I need to know size of the side of a tile, so I simply used Pythagorean theorem for this: In right-angled triangle ABC side AC = width / 2 = 32 and side AB = height / 2 = 16. Thus side of a tile (BC) can be calculated as: So whole tile is a rhombus in which each side = 35.777. However when I add an square object with dimensions 35

How to translate Tiff.ReadEncodedTile to elevation terrain matrix from height map in C#?

心不动则不痛 提交于 2019-12-08 03:30:32
问题 I'm new with working with reading tiff images and I'm trying to get the elevation terrain values from a tiff map by using LibTiff. The maps I need to decode are tile organized. Below the fragment of the code I'm using currently to get these values, based on the library documentation and research on the web: private void getBytes() { int numBytes = bitsPerSample / 8; //Number of bytes depending the tiff map int stride = numBytes * height; byte[] bufferTiff = new byte[stride * height]; // this

Overlay ggplot grouped tiles with polygon border depending on extra factor

一世执手 提交于 2019-12-07 19:45:57
问题 I have a data frame with x and y positions and two factor columns blocknr and cat: dput(testData) structure(list(xpos = c(2L, 8L, 5L, 8L, 1L, 4L, 5L, 1L, 8L, 4L, 3L, 2L, 6L, 5L, 1L, 7L, 3L, 4L, 3L, 7L, 1L, 6L, 7L, 7L, 2L, 5L, 3L, 4L, 6L, 7L, 1L, 5L, 1L, 6L, 4L, 5L, 3L, 6L, 4L, 8L, 1L, 3L, 4L, 6L, 7L, 3L, 2L, 6L, 4L, 2L, 1L, 7L, 4L, 8L, 2L, 3L, 2L, 5L, 8L, 2L, 8L, 3L, 3L, 5L, 6L, 7L, 1L, 5L, 6L, 4L, 2L, 6L, 7L, 1L, 5L, 7L, 2L), ypos = c(1L, 2L, 8L, 1L, 6L, 7L, 1L, 4L, 6L, 1L, 2L, 3L, 4L, 5L,

tiled map on android

∥☆過路亽.° 提交于 2019-12-07 17:12:17
问题 I want to implement an offline map of an area(city size), I need to use tiled map with several zoom levels and be able to zoom in/out by pinching on the map, double tap, pan and so on. I don't want to use OpenStreetmap. The map I use is a transit map, so it is very different from openstreetmap. I have tools to cut the map into tiles. I wonder if there is any free library that I can use, I know this question has been asked(like android tiled map technique) but I could not find an acceptable