發表文章

Easy Triangle Calculator

Privacy Policy Effective date: 03 / 30, 2020 Flash Shooting ("us", "we", or "our") operates the Flash Shooting mobile application (hereinafter referred to as the "Service"). This page informs you of our policies regarding the collection, use, and disclosure of personal data when you use our Service and the choices you have associated with that data. Our Privacy Policy for Flash Shooting is created with the help of the Privacy Policies website . We use your data to provide and improve the Service. By using the Service, you agree to the collection and use of information in accordance with this policy. Unless otherwise defined in this Privacy Policy, the terms used in this Privacy Policy have the same meanings as in our Terms and Conditions. Information Collection And Use We collect several different types of information for various purposes to provide and improve our Service to you. Types of Data Collected Personal Data While using

Flash Shooting Game

圖片
Privacy Policy Effective date: January 29, 2019 Flash Shooting ("us", "we", or "our") operates the Flash Shooting mobile application (hereinafter referred to as the "Service"). This page informs you of our policies regarding the collection, use, and disclosure of personal data when you use our Service and the choices you have associated with that data. Our Privacy Policy for Flash Shooting is created with the help of the Privacy Policies website . We use your data to provide and improve the Service. By using the Service, you agree to the collection and use of information in accordance with this policy. Unless otherwise defined in this Privacy Policy, the terms used in this Privacy Policy have the same meanings as in our Terms and Conditions. Information Collection And Use We collect several different types of information for various purposes to provide and improve our Service to you. Types of Data Collected Personal Data W

Swift Sprite Kit add Tile Crash

#Swift Sprite Kit# ##Add Tile to sks crash## when you add image to Assets.xcassets then you go to your GameScene.sks add Tile Map Node every time XCODE crash. you can close your project first and goto your project folder only open your Map.sks and add image to sks file, when add completed save file and open project, then you can watch your map image and edit.

Swift Sprite Kit easy to create bullet

圖片
#Swift Sprite Kit# ##Easy create bullet## How to easy create bullet like picture 1. Create SkSpriteNode ``` var bullet = SKSpriteNode() ``` 2. Add SKSpriteNode to View ``` func bulletFire(){ bullet = SKSpriteNode(color: UIColor.green, size: CGSize(width: 5, height: 50)) bullet.name = "fireBullet" addChild(bullet) bullet.zPosition = 2 let move = SKAction.moveTo(y: self.frame.height, duration: 1) bullet.run(move) } ``` 3. Set remove Node after Node leave View ``` self.enumerateChildNodes(withName: "fireBullet") { (node : SKNode, nil) in if node.position.y > self.frame.height / 2 { node.removeFromParent() } } ``` 4. Add Node to TouchesBegin ``` override func touchesBegan(_ touches: Set , with event: UIEvent?) { for t in touches { self.touchDown(atPoint: t.location(in: self)) var pos : CGPoint = t.location(in: self) bulletFire() } } ```

Swift SpritKit : background image move

圖片
#Swift Spirte Kit# ##Background Image move# 如何連續移動背景圖,先看原理 先將 img-1 從 view 之中移動到 view 的下方直到看不到在移動回到 view 之中 再設定一組 img-2 從 view 的上面移動到 view 之中再回到 view 的上方 記住兩組的移動時間必須一至的 如何開始 宣告兩組變數 ``` var background = SKSpriteNode() var background02 = SKSpriteNode() ``` 設定第一組圖片 ``` background = SKSpriteNode(imageNamed: "image name") background.size = CGSize(width: self.size.width, height: self.size.height) background.position.y = self.size.height background.zPosition = -1 self.addChild(background) let move1 = SKAction.moveTo(y: self.frame.midY, duration: 30) let move2 = SKAction.moveTo(y: self.size.height, duration: 0) let seq = SKAction.sequence([move1,move2]) background.run(SKAction.repeatForever(seq)) ``` 設定第二組圖片 ``` background02 = SKSpriteNode(imageNamed: "country-platform-back") background02.size = CGSize(width: self.size.width, height: self.size.height) background02.zPosition = -1 background02.position.y = self.frame.midY //+ background02.size.height self

Swift Sprite Kit : SKShapeNode of circle

#Swift Sprite Kit# ##SKShapeNode of circle## I has create new circle on the Sprite Kit How to Create circle on Sprite Kit 1. Setup SKShapeNode ``` var newSprit = SKShapeNode() ``` 2. Create circle ``` newSprit = SKShapeNode(circleOfRadius: 25) self.addChild(newSprit) ``` 3. Setup Physicsbody ``` newSprit.physicsBody = SKPhysicsBody(circleOfRadius: 25) ``` Full Code : ``` var newSprit = SKShapeNode() func createNewSprite(point : CGPoint) { newSprit = SKShapeNode(circleOfRadius: 25) newSprit.strokeColor = UIColor.orange newSprit.fillColor = UIColor.orange newSprit.name = "TEST" newSprit.physicsBody = SKPhysicsBody(circleOfRadius: 25) self.addChild(newSprit) } ```

Switf Sprite remove NODE

#Swift Sprite Kit# ## Remove Node, if Node leave View## set ``` var newSprit = SKSpriteNode() ``` create function for Node create ``` func createNewSprite(point : CGPoint) { newSprit = SKSpriteNode(color: UIColor.orange, size: CGSize(width: 50, height: 50)) newSprit.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: 50, height: 50)) newSprit.position = point self.addChild(newSprit) } ``` on ```override func update(_ currentTime: TimeInterval)``` add new code ``` self.enumerateChildNodes(withName: String, using: (SKNode, UnsafeMutablePointer) -> Void) ``` check your View first, if your View setup by Portrait, you may check your node leave view by point X if your View setup by Landscape, you may check your node leave view by point y Code: ``` self.enumerateChildNodes(withName: "TEST") { (node : SKNode, nil) in if node.position.x < -320 || node.position.x > 320 { print("remove node")