Live data from Hacker News

Flappy Bird in Swift

github.com

91–100 of 126 posts

Re: Flappy Bird in Swift

#91
post #20

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...

Note that near the top of "A Swift Tour" there is a link to the playground which you can download and open in Xcode 6.

Re: Flappy Bird in Swift

#92

This 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.

There's also a new graphics API, 'Metal', though I don't know if that has anything to do with it.

Re: Flappy Bird in Swift

#93

Author 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

#94

Author 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

This is awesome and I didn't know this. Thanks for posting it - I don't have much swift experience so I assume there are several things in the code that will be shown to be non-standard.

Re: Flappy Bird in Swift

#95

From the GIF in the readme, it looks like collision detection is broken.

I'm terrible at flappy bird - I can /sometimes/ get through the first pipe. Rarely.

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

#96

Author 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!

Any up-to-date C# developer already knows Swift.

Re: Flappy Bird in Swift

#98
post #38
post #5

I 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?

Since I'm being downvoted... please excuse my poor attempt at sarcasm.

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

#99
post #5

I 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…

>>mammalian brain

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.

Post reply on HN