Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"let scene" and "let transition" raise a warning #1

Open
sonobianca opened this issue Sep 23, 2016 · 11 comments
Open

"let scene" and "let transition" raise a warning #1

sonobianca opened this issue Sep 23, 2016 · 11 comments

Comments

@sonobianca
Copy link

During Chapter 2, when we set the scene and the transitions in the code, both lines raise a Warning telling us "Initialization of immutable value 'transition' was never used; consider replacing with assignment to _ or removing it.

Should we declare those constants in the class declaration without initializing them and instead of declaring inside a function only initialize them?

I'm new to swift, but I have a solid background in programming... rusty, but solid ;)

@spritekitbook
Copy link
Owner

spritekitbook commented Sep 23, 2016

Hi Sonoblaise,

I believe you may be talking about the method called loadScene() that is added to the MenuScene, GameScene and GameOverScene classes near the end of the class.

Both "scene" and "transition" are used in the next line of the method that tells the view to present the scene like this.

        self.view?.presentScene(scene, transition: transition)

I double checked the book to make sure that is there. Below is an example of the complete method loadScene() as it would appear in MenuScene.

    private func loadScene() {
        let scene = GameScene(size: kViewSize)
        let transition = SKTransition.fade(with: SKColor.black, duration: 0.5)

        self.view?.presentScene(scene, transition: transition)
    }

Let me know if you still have questions or if that wasn't clear in the book so I can update it.

Thanks!

@sonobianca
Copy link
Author

I just realized, when writing the second loadScene() function that the
warning disappears after you write down the next line:
Self.view?.presentScene(...)

I think I'm just not used to have an IDE that is so responsive. And I've
been out of the game for a while too ;)

Sorry for bothering you!

On Thursday, 22 September 2016, Jeremy Novak [email protected]
wrote:

Hi Sonoblaise,

I believe you may be talking about the method called loadScene() that is
added to the MenuScene, GameScene and GameOverScene classes near the end of
the class.

Both of "scene" and "transition" are used in the next line of the method
that tells the view to present the scene like this.

    self.view?.presentScene(scene, transition: transition)

I double checked the book to make sure that is there. Below is an example
of the complete method loadScene().

private func loadScene() {
    let scene = GameScene(size: kViewSize)
    let transition = SKTransition.fade(with: SKColor.black, duration: 0.5)

    self.view?.presentScene(scene, transition: transition)
}

Let me know if you still have questions or if that wasn't clear in the
book so I can update it.

Thanks!


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARqjDFn3qvnxEcySXnSV5VZNO6K68Y7-ks5qszR1gaJpZM4KEiV7
.

Blaise Bernier - Soundman FOH/Mon, PA Tech

[email protected]

514-358-3481

@spritekitbook
Copy link
Owner

No worries :)

Yes, the LLVM compiler (compiler in Xcode) is pretty quick on the draw as you type with errors and warnings. Hopefully you'll be used to it soon. Glad it is working for you.

@sonobianca
Copy link
Author

Found a piece of explanation that should be revised. Page 60, when you
introduce the Smooth() function, you say it returns a CGPoint that is
somewhere between two other CGPoint when, in fact, it's returning a CGFloat
that is located between two other CGFloats. The result will be used to
calculate the coordinates for a new CGPoint.

It just made me wonder where the mistake was. I usually read the code,
then the explanation and then I type the code in manually (helps getting it
stuck in your head). But this time, the explanation and the code didnt add
up.

Great work BTW! The book is well done so far. In a few spots I would have
loved deeper explanation of some Swift concepts, but I managed to get the
details I wanted in Apple's documentation.

On Thursday, 22 September 2016, Jeremy Novak [email protected]
wrote:

No worries :)

Yes, the LLVM compiler (compiler in Xcode) is pretty quick on the draw as
you type with errors and warnings. Hopefully you'll be used to it soon.
Glad it is working for you.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARqjDGCiW8Yg0yyp5m7ktSkTfzWarFykks5qszdKgaJpZM4KEiV7
.

Blaise Bernier - Soundman FOH/Mon, PA Tech

[email protected]

514-358-3481

@spritekitbook
Copy link
Owner

Great point, I will make that more clear. Yes, it is taking a starting and ending CGFloat and returning a CGFloat just as you figured out.

Glad you are enjoying the book, and really appreciate the feedback!

@sonobianca
Copy link
Author

I finally finished the whole thing, modified a few details to my own taste
and I can say that I feel pretty ready to go on my own! I noted a few more
things to fix in the book and I took the liberty to list them for you:

Page 104 :

  • Forgot to add the “starsLabel” object in the hierarchy:

barBackground.addChild(starsIcon)

barBackground.addChild(starsLabel) // This should be here

  • “setupStars()” should be “setupStarsCollected()” if we follow the call
    made to it on page 103 and the “updateStarsCollected()” naming convention

Page 105 :

  • Indentation problem on the “fun update(lives: Int) {“ line

Page 107 :

  • “updateDistanceTick()” in the text should be “updateDistanceScore()”
  • “updateStars()” should be “updateStarsCollected()” as declared earlier

Page 143 :

  • Filename should be “Explosion.sks” as we created it before, not
    “Explode.sks”

Page 149 :

  • “Update the Background class”: the gameOver method was already added
    at the very beginning of the book when creating the Background class on
    page 49

Thanks again for the great work!

Blaise Bernier - Mixer (FOH/Mon) - PA Tech - System Designer

(514) 358-3481

[email protected]

2016-09-26 18:37 GMT-04:00 Jeremy Novak [email protected]:

Great point, I will make that more clear. Yes, it is taking a starting and
ending CGFloat and returning a CGFloat just as you figured out.

Glad you are enjoying the book, and really appreciate the feedback!


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARqjDEkQTeFc4WMxsey7GgJuTf33rJmPks5quEk2gaJpZM4KEiV7
.

@spritekitbook
Copy link
Owner

spritekitbook commented Sep 29, 2016

Appreciate you pointing those out. I'll get the book updated today with your errata.

Thanks, and glad you enjoyed the book!

@sonobianca
Copy link
Author

Glad I could help! I'll probably start on the timberman book today too.
I'll keep you informed if I find anything. I'll start another thread on
git hub if I do so it keeps things organized for you ;)

On Thursday, 29 September 2016, Jeremy Novak [email protected]
wrote:

Appreciate you pointing those out. I'll get the book updated today with
your errata.

Thanks, and glad you enjoyed the book!

  • Jeremy


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARqjDBLDacuhHNQ9p_S6pOurN9HK3eqOks5qu9xrgaJpZM4KEiV7
.

Blaise Bernier - Soundman FOH/Mon, PA Tech

[email protected]

514-358-3481

@sonobianca
Copy link
Author

Oh, sadly I see that you are still updating it to swift 3! No rush! At
least you know you'll sell one right away ;)

On Thursday, 29 September 2016, Blaise Bernier [email protected] wrote:

Glad I could help! I'll probably start on the timberman book today too.
I'll keep you informed if I find anything. I'll start another thread on
git hub if I do so it keeps things organized for you ;)

On Thursday, 29 September 2016, Jeremy Novak <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

Appreciate you pointing those out. I'll get the book updated today with
your errata.

Thanks, and glad you enjoyed the book!

  • Jeremy


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARqjDBLDacuhHNQ9p_S6pOurN9HK3eqOks5qu9xrgaJpZM4KEiV7
.

Blaise Bernier - Soundman FOH/Mon, PA Tech

[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');

514-358-3481

Blaise Bernier - Soundman FOH/Mon, PA Tech

[email protected]

514-358-3481

@spritekitbook
Copy link
Owner

The Timberman book should be done in the next week, I'm a few chapters in right now. I updated this book with your errata, should be available to update from the store within the next few hours. Thanks again!

@sonobianca
Copy link
Author

You're welcome! I really got to like Swift because of your book. There is
sadly so little about Swift 3 so far and most of it is iOS oriented.
That's why I started with your book, since I wanted to go back to game
developement an SpriteKit is the same framework on both iOS and OS X.

Looking forward to timberman!

On Thursday, 29 September 2016, Jeremy Novak [email protected]
wrote:

The Timberman book should be done in the next week, I'm a few chapters in
right now. I updated this book with your errata, should be available to
update from the store within the next few hours. Thanks again!


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARqjDIdw6_dPISNHYKX_C7GRq2opyqbFks5qu_3egaJpZM4KEiV7
.

Blaise Bernier - Soundman FOH/Mon, PA Tech

[email protected]

514-358-3481

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants