please make me a turn based stretegy game based on what I have:
import SpriteKit
import UIKit
import GameplayKit

class GameScene: SKScene {
let mapWidth = 60
let mapHeight = 20
let tileSize: CGFloat = 50
var gameMap: [[Int]] = []
var gridNode: SKNode!
var lastTouch: CGPoint?
var player: SKSpriteNode!
var highlightedTiles: [SKNode] = []
var isHighlightingTiles = false
let playerSpeed: CGFloat = 200

reasonml
Copy
override func didMove(to view: SKView) {
    createMap()
    createGrid()

    // Create a new camera node
    let cameraNode = SKCameraNode()
    addChild(cameraNode)

    // Set the new camera node as the scene's camera
    camera = cameraNode

    // Set the position of the camera node
    cameraNode.position = CGPoint(x: size.width / 2, y: size.height / 2 - 200)

    // Set the z-position of the camera node
    cameraNode.zPosition = 10
    
    player = SKSpriteNode(color: .red, size: CGSize(width: tileSize * 1, height: tileSize * 1))
    player.position = CGPoint(x: tileSize * CGFloat(mapWidth / 2) - 25, y: tileSize * CGFloat(mapHeight / 2) - 25)
    player.zPosition = 5
    addChild(player)
    
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    lastTouch = touches.first?.location(in: self)

    // Check if the player is clicked
    if let touch = touches.first, player.contains(touch.location(in: self)) {
        isHighlightingTiles = !isHighlightingTiles

        if isHighlightingTiles {
            // Get the map coordinates of the player
            let playerMapX = Int(floor(player.position.x / tileSize))
            let playerMapY = Int(floor(player.position.y / tileSize))
            let playerPosition = CGPoint(x: playerMapX, y: playerMapY)

            // Enumerate the tiles around the player that it's able to move to
            let tiles = enumerateTilesAroundPlayer(playerPosition: playerPosition, distance: 4)

            // Highlight the tiles
            for tile in tiles {
                let node = SKSpriteNode(color: UIColor.green.withAlphaComponent(0.5), size: CGSize(width: tileSize, height: tileSize))
                node.position = CGPoint(x: tile.x * tileSize + tileSize/2, y: tile.y * tileSize + tileSize/2)
                node.zPosition = 1
                gridNode.addChild(node)
                highlightedTiles.append(node)
            }
        } else {
            // Remove the highlighted tiles
            for node in highlightedTiles {
                node.removeFromParent()
            }
            highlightedTiles.removeAll()
        }
    } else {
        // Check if a highlighted tile was clicked
        var touchedHighlightedTile: SKNode?
        if let touch = touches.first {
            for node in highlightedTiles {
                if node.contains(touch.location(in: gridNode)) {
                    touchedHighlightedTile = node
                    break
                }
            }
        }

        // Remove the highlighted tiles
        for node in highlightedTiles {
            node.removeFromParent()
        }
        highlightedTiles.removeAll()

        // Move the player if a highlighted tile was clicked
        if let tile = touchedHighlightedTile {
            let destination = CGPoint(x: tile.position.x - tileSize/2 + 25, y: tile.position.y - tileSize/2 + 25)
            movePlayer(to: destination)
        }
    }
}

override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
    guard let touch = touches.first else { return }
    guard let lastTouch = lastTouch else { return }

    let touchLocation = touch.location(in: self)
    let lastTouchLocation = lastTouch

    let dx = touchLocation.x - lastTouchLocation.x
    let dy = touchLocation.y - lastTouchLocation.y

    let cameraX = camera?.position.x ?? 0
    let cameraY = camera?.position.y ?? 0

    camera?.position = CGPoint(x: cameraX - dx, y: cameraY - dy)

    self.lastTouch = touchLocation
}
func createMap() {
    // Generate a random map
    for _ in 0..<mapHeight {
        var row: [Int] = []

        for _ in 0..<mapWidth {
            let tileType = Int.random(in: 0...1)
            row.append(tileType)
        }

        gameMap.append(row)
    }
}

func createGrid() {
    gridNode = SKNode()
    addChild(gridNode)

    // Draw the grid lines
    for x in 0..<mapWidth {
        let node = SKShapeNode(rectOf: CGSize(width: 1, height: tileSize * CGFloat(mapHeight)))
        node.position = CGPoint(x: tileSize * CGFloat(x), y: tileSize * CGFloat(mapHeight / 2))
        node.strokeColor = .gray
        gridNode.addChild(node)
    }

    for y in 0..<mapHeight {
        let node = SKShapeNode(rectOf: CGSize(width: tileSize * CGFloat(mapWidth), height: 1))
        node.position = CGPoint(x: tileSize * CGFloat(mapWidth / 2), y: tileSize * CGFloat(y))
        node.strokeColor = .gray
        gridNode.addChild(node)
    }
}

func enumerateTilesAroundPlayer(playerPosition: CGPoint, distance: Int) -> [CGPoint] {
    var tiles: [CGPoint] = []
    
    for x in Int(playerPosition.x) - distance ... Int(playerPosition.x) + distance {
        for y in Int(playerPosition.y) - distance ... Int(playerPosition.y) + distance {
            let dx = CGFloat(x) - playerPosition.x
            let dy = CGFloat(y) - playerPosition.y
            let tileDistance = sqrt(dx * dx) + sqrt(dy * dy)
            
            if tileDistance <= CGFloat(distance) {
                tiles.append(CGPoint(x: x, y: y))
            }
        }
    }
    
    return tiles
}
func movePlayer(to destination: CGPoint) {
    // Remove the highlighted tiles
    for node in highlightedTiles {
        node.removeFromParent()
    }
    highlightedTiles.removeAll()

    // Calculate the horizontal and vertical distances relative to the player's current position
    let dx = destination.x - player.position.x
    let dy = destination.y - player.position.y
    let horizontalDistance = abs(dx)
    let verticalDistance = abs(dy)

    // Calculate the duration of the movement action based on the player's speed
    let distance = sqrt(dx*dx) + sqrt(dy*dy)
    let duration = TimeInterval(distance / playerSpeed)

    // Create separate actions for horizontal and vertical movement
    var actions: [SKAction] = []
    if horizontalDistance > 0 {
        let horizontalDuration = TimeInterval(abs(dx) / playerSpeed)
        let horizontalAction = SKAction.moveBy(x: dx, y: 0, duration: horizontalDuration)
        actions.append(horizontalAction)
    }
    if verticalDistance > 0 {
        let verticalDuration = TimeInterval(abs(dy) / playerSpeed)
        let verticalAction = SKAction.moveBy(x: 0, y: dy, duration: verticalDuration)
        actions.append(verticalAction)
    }

    // Run the actions sequentially
    let sequenceAction = SKAction.sequence(actions)
    player.run(sequenceAction)
}
}