This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NewPlaceViewController.swift | |
// tell2 | |
// | |
// Created by Alcides Junior on 02/10/19. | |
// Copyright © 2019 Alcides Junior. All rights reserved. | |
// | |
import UIKit | |
import MapKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AddressViewController.swift | |
// tell2 | |
// | |
// Created by Alcides Junior on 05/10/19. | |
// Copyright © 2019 Alcides Junior. All rights reserved. | |
// | |
import UIKit | |
import MapKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | |
//vamos pegar o node que foi atualmente tocado | |
let location = touches.first?.location(in: self) | |
let currentNode = nodes(at: location!) | |
//verificando quem é o node a partir da propriedade NAME | |
if currentNode.first?.name == "blueButton"{ | |
self.changeBoardColor(color: .blue) | |
self.blueButton.lineWidth = 8 | |
self.redButton.lineWidth = 1 | |
}else if currentNode.first?.name == "redButton"{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func changeBoardColor(color: UIColor){ | |
self.board.fillColor = color | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func didMove(to view: SKView) { | |
//adicionando os elementos na tela | |
addChild(blueButton) | |
addChild(redButton) | |
addChild(board) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//criando uma board que será o alvo das ações nos botões | |
private lazy var board: SKShapeNode = { | |
//criando uma board quadrada | |
let btn = SKShapeNode(rectOf: CGSize(width: 300, height: 300)) | |
//posicionando a board no centro da tela | |
btn.position = CGPoint(x: (view?.frame.width)!/2, y: (view?.frame.height)!/2) | |
//definindo uma cor para a board | |
btn.fillColor = .white | |
//definindo a espessura da borda | |
btn.lineWidth = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let anim2 = SKAction.animate(with: [SKTexture(imageNamed: "5"),SKTexture(imageNamed: "6"),SKTexture(imageNamed: "7"),SKTexture(imageNamed: "8"),SKTexture(imageNamed: "9"),SKTexture(imageNamed: "10"),SKTexture(imageNamed: "11"),SKTexture(imageNamed: "12")], timePerFrame: 0.6) | |
self.fakeTexture.size = CGSize(width: 487, height: 236) | |
self.fakeTexture.run(SKAction.repeatForever(SKAction.sequence([anim2]))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//dentro do didMove setamos o delegate | |
physicsWorld.contactDelegate = self |