I just started exploring the Book: The Swift Programming Language by Apple Inc. Link: https://itunes.apple.com/us/book/the-swift-programming-langu... Hope it helps.
And the same, in HTML form: https://developer.apple.com/library/prerelease/ios/documenta...
Flappy Bird in Swift
91–100 of 126 posts
Re: Flappy Bird in Swift
#92This may be a stupid question but is the language in some way tailored to game programming? Apple's examples at WWDC were game companies, their coding demo was a game, and this is the first project I've seen written in it - and it's a game.
Re: Flappy Bird in Swift
#93Author here - I didn't expect to see this here this morning. I'd intended to write a longer post :) In any case, here's a few things I learned about swift yesterday building this. Please note that I have about 4 hours swift experience, so feel free to correct anything I say that's wrong. 1. To make properties on a class you simply declare the variable on the class e.g.: class GameScene: SKScene { var bird = SKSpriteN…
var spawn = SKAction.runBlock({() in self.spawnPipes()})
with var spawn = SKAction.runBlock({self.spawnPipes()})
or even var spawn = SKAction.runBlock() {self.spawnPipes()}
or var spawn = SKAction.runBlock {self.spawnPipes()}
EDIT: formatting for codeRe: Flappy Bird in Swift
#94Author here - I didn't expect to see this here this morning. I'd intended to write a longer post :) In any case, here's a few things I learned about swift yesterday building this. Please note that I have about 4 hours swift experience, so feel free to correct anything I say that's wrong. 1. To make properties on a class you simply declare the variable on the class e.g.: class GameScene: SKScene { var bird = SKSpriteN…
I don't have XCode to try it out, but according to the book, you can replace var spawn = SKAction.runBlock({() in self.spawnPipes()}) with var spawn = SKAction.runBlock({self.spawnPipes()}) or even var spawn = SKAction.runBlock() {self.spawnPipes()} or var spawn = SKAction.runBlock {self.spawnPipes()} EDIT: formatting for code
Re: Flappy Bird in Swift
#95From the GIF in the readme, it looks like collision detection is broken.
I didn't build the collision detection yet just b/c I actually think it's more fun to play this way.
That said, we'll add it before too long.
Re: Flappy Bird in Swift
#96Author here - I didn't expect to see this here this morning. I'd intended to write a longer post :) In any case, here's a few things I learned about swift yesterday building this. Please note that I have about 4 hours swift experience, so feel free to correct anything I say that's wrong. 1. To make properties on a class you simply declare the variable on the class e.g.: class GameScene: SKScene { var bird = SKSpriteN…
I think just the fact that you were able to build a game with just 4 hours of learning a new language speaks volumes about Swift's barrier to entry. Well done!
Re: Flappy Bird in Swift
#97Re: Flappy Bird in Swift
#98I got mixed feelings about the language at first sight. I guess my mammalian brain recognizes languages based on the particular combination of the following naming decisions. * func, function, fun, defun fu, funct * CamelCase vs snake_case * whitespace, semicolon or comma usage * var, int/integer/uint64/Integer/ * choice of (), {}, [] or better (){a[]} * import/include/require, class/class, override, self vs this, ne…
> PS: next time you design a new language just make a random unique combination of the above. That's my impression whenever I see a new programming language too. Why would someone switch to your language if the syntax is just the same boring old syntax they've been using in another language?
What I'm saying is that I sometimes get the impression that language designers randomly change up syntax just to make their language look different, and thus superficially more appealing to users. Just like any other kind of product.
Re: Flappy Bird in Swift
#99I got mixed feelings about the language at first sight. I guess my mammalian brain recognizes languages based on the particular combination of the following naming decisions. * func, function, fun, defun fu, funct * CamelCase vs snake_case * whitespace, semicolon or comma usage * var, int/integer/uint64/Integer/ * choice of (), {}, [] or better (){a[]} * import/include/require, class/class, override, self vs this, ne…
Woof woof! I got one too. My view of Swift is: not a good enough reason not to continue using Lua for the same problem.
Re: Flappy Bird in Swift
#100Flappy Bird in Racket | https://github.com/soegaard/flappy-bird