ユーザーのタッチ位置にオブジェクトを作成する関数を作成しましたが、タイル マップに従って、タイルの中心に自動的に位置合わせしたいと考えています。
現在、オブジェクトを最も近いタイルに自動リダイレクトするのではなく、タッチした場所にしかオブジェクトを配置できません。
http://puu.sh/ggxOG/2785a2eeca.png (これは私のタイルが 32x32 のように見える方法です)
JSTileMap 関数
@class JSTileMap;
@interface TMXLayer : SKNode
@property (strong, nonatomic) TMXLayerInfo* layerInfo;
@property (strong, nonatomic) NSMutableSet* tileInfo; // contains TMXTilesetInfo objects
@property (assign, nonatomic) CGSize mapTileSize;
/** Returns the width of the layer (layerGridSize.width * mapTileSize.width) */
@property (readonly,nonatomic) CGFloat layerWidth;
/** Returns the height of the layer (layerGridSize.height * mapTileSize.height) */
@property (readonly,nonatomic) CGFloat layerHeight;
/** Returns the JSTileMap that contains this layer */
@property (weak, nonatomic) JSTileMap* map;
- (CGPoint)pointForCoord:(CGPoint)coord;
- (CGPoint)coordForPoint:(CGPoint)point;
- (void)removeTileAtCoord:(CGPoint)coord;
- (SKSpriteNode*)tileAt:(CGPoint)point;
- (SKSpriteNode*)tileAtCoord:(CGPoint)coord;
- (int)tileGidAt:(CGPoint)point;
- (id)propertyWithName:(NSString*)name;
- (NSDictionary*)properties;
@end