View sunburst.swift
let radius: CGFloat = 150 / 2.0
let bezierPath = CGMutablePath()
let centerPoint = CGPoint(x: 0, y: 0)
var thisPoint = CGPoint(x: radius, y: 0)
bezierPath.move(to: centerPoint)
var thisAngle: CGFloat = 90
let unitCount: CGFloat = count
let spacingDegrees: CGFloat = 6.0
let sliceDegrees: CGFloat = 360.0 / unitCount - spacingDegrees
View comment_import.py
import xmltodict
import time
import hashlib
import os
import cgi
"""
Desired structure based on my post URLS: /data/comments/2016-07-12-post-slug/comment-uniquehash.yml
Data in comment is structured like this:
View cutscene.swift
self.entity.ui?.cutscene?.addSequences(sequences: [
self.bringSpeakersIntoView(),
self.stouWarnsUnderAttack(),
self.delayForTime(time: 4),
self.barricOffersHisTroops(),
self.panCameraForFight(),
self.takeSpeakersOutOfView()
])
View SKTransform.swift
let transfomLayer = SKTransformNode()
let settings = SKSpriteNode(imageNamed:"icon_Settings")
transfomLayer.addChild(settings)
transfomLayer.setEulerAngles(vector_float3(x:120, y:0, z:0))
transfomLayer.zPosition = 10000
transfomLayer.position = CGPoint(x:500, y:500)
self.addChild(transfomLayer)
let rotate = SKAction.rotate(byAngle: 6.28, duration: 5)
settings.run(SKAction.repeatForever(rotate))
View 0105changeling.txt
Leveling Up & UI
- Double confirmation UI pattern (delet save file for an example)
- Unit abilities card shows ability description, and updates unit stats in preview mode
- After battle combat shows more information (still bugs & polish needed)
- You can actually choose a new skill when a unit levels up
- Unit cards now show stars for the units level
- Navigation icons show red circle withnumber when upgrades are available
In Game
- Performance imporvement for sounds (still a major bottleneck though)
View navmesh.swift
//
// PKNavmesh.swift
// PathKit
//
// Created by Ryan Campbell on 9/12/16.
// Copyright © 2016 Phalanx Studios. All rights reserved.
//
import SpriteKit
import GameplayKit
View Launch.swift
/// Uses physics equations to calculate position of projectile at given time.
/// This tool is awesome to explain what's happening, and play with sample data:
/// http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html#tra6
func launchAtPoint(angle:CGFloat, start:CGPoint, end:CGPoint, node:SKNode) -> SKAction {
/// Constants
let gravity : Double = 9.8
let pixelsToMeters : CGFloat = 50
/// Calculate everything we can given an angle and an end point
View Swift3SaveUsage.swift
/// User clicks on slot one, so we want to create a new save file for that slot
if GameData.sharedInstance.loadGame(saveFile: "One") {
/// An existing save file was there, progress as you need to
}
else {
/// A new save file was created, so start your game from a fresh state
}
/// User buys 100 gold
GameData.sharedInstance.bank += 100
View Swift3SaveClass
class Level : NSObject, NSCoding {
var highScore : Double = 0
var completed : Bool = false
var revealed : Bool = false
required init?(coder: NSCoder) {
self.highScore = coder.decodeDouble(forKey: "highScore")
View Swift3Save.swift
import SpriteKit
class GameData : NSObject, NSCoding {
/// Current game slot being played "One" to "Four"
var currentSaveFile : String? = nil
/// A string to save
var variableA : String = "AString"