These are chat archives for dinhjeffrey/PanerasBlueberryBagel

6th
Aug 2016
James Orzechowski
@doanyway
Aug 06 2016 17:09
hi Ish
hi Brian
TriskelionStudios
@TriskelionStudios
Aug 06 2016 17:11
I'm in
Add 3 pokemon code:
    let pokemon1 = pokemon[Int(arc4random_uniform(UInt32(pokemon.count)))]
    let pokemon2 = pokemon[Int(arc4random_uniform(UInt32(pokemon.count)))]
    let pokemon3 = pokemon[Int(arc4random_uniform(UInt32(pokemon.count)))]
TriskelionStudios
@TriskelionStudios
Aug 06 2016 17:31
here's a tile image
James Orzechowski
@doanyway
Aug 06 2016 18:08
        scene.scaleMode = .ResizeFill  in GameViewController
also change to be landscape only
Jeffrey Dinh
@dinhjeffrey
Aug 06 2016 18:09
// A GridPoint is a structure that represents a location in the grid.
// This is Hashable, because it will be stored in a dictionary.
struct Position: Hashable {
    let row, column: Int

    var hashValue: Int {
        get {
            return row ^ (column << 32)
        }
    }
}

// If an object is Hashable, it's also Equatable. To conform
// to the requirements of the Equatable protocol, you need
// to implement the == operation (which returns true if two objects
// are the same, and false if they aren't)
func ==(first : Position, second : Position) -> Bool {
    return first.row == second.row && first.column == second.column
}
Ish
@ishabazz_twitter
Aug 06 2016 18:21

struct Tile:Hashable{

let position:Position
let size: CGFloat

var hashValue: Int{
    get{
        return position.hashValue
    }
}

}

func ==(first : Tile, second : Tile) -> Bool {
return first.position == second.position
}

func createTiles(size:CGFloat) -> [Tile]{
var tileArray:[Tile] = []

for xPositon in 0 ... 9 {

    for yPosition in 0 ... 9 {

        tileArray.append(Tile(position: Position(row: xPositon, column: yPosition), size: size))
    }

}

return tileArray

}

func positionFor(coordinate point: CGPoint) -> Position{

let screenWidth:CGFloat = 320
let tileWidth = screenWidth / 10

let x = floor(point.x / tileWidth)

let y = floor(point.y / tileWidth)

return Position(row: Int( y), column: Int(x))

}