mikecargal

mikecargal

Apple Game Frameworks and Technologies: Chapter 5 question

Title: Name of book: Apple Game Frameworks and Technologies (Chapter 5 “die” animation)

Not an errata that I can tell so far…

I’m at the point in Chapter 5 of changing to the “die” animation on gameOver().

For some reason, the display does not change to the “die” png.

I’ve placed print() debugging statements in the player::die() method

    func die() {
        print("Player::die()")
        guard let dieTextures = dieTextures else {
            preconditionFailure("Could not find die textures!")
        }
        print("removeAction(forKey: \"walk\"")
        removeAction(forKey: "walk")
        
        print("dieTextures=>>\(dieTextures)<<")
        print("startAnimation(name:\"die\"")
        
        startAnimation(textures: dieTextures, speed: 0.25,
                       name: "die",
                       count: 0, resize: true, restore: true)
    }

and I get the following in the debug console:

player hit collectible
player hit collectible
collectible hit foreground
Player::die()
removeAction(forKey: "walk"
dieTextures=>>[<SKTexture> 'blob-die_0' (186 x 196)]<<
startAnimation(name:"die"

So, I know:

  • the die() method is being called.
  • the dieTextures has a single entry named “blob-die_0” (dimensions 186x196 on iPhone 8 simulator (and I see the 3x dimensions if I run on another simulator), so it really seems like it’s finding the png assets. (I followed the link in the assets, and it opened a directory that has the “sad blob” images.)

But this is what the screen looks like (you can even see the rectangle missing from removing the physics attributes from the drop

I’ve thought about comparing to the “end” project but there’s a lot of stuff left in the chapter before I get to the “end” state (so not applicable to current state). (I did start from my own previous project state (not the “start” project file. I may re-work my way through chapter 5 to this point on that project . But, I generally find that I learn a lot be trying to debug whatever I did wrong. In this case I’ve read, re-read, re-compared the steps in chapter 5 until I’m cross-eyed. (The changes for the labels, and everything up to this are all “working”)

So, as a question… does anyone have a suggestion as to where I should look. (I’m in that debugging state, where there’s so little involved in the changes, that I can’t see what I may have missed). Hoping someone has been here and can point me in the right direction.

Oh yeah… feel free to tell me “you’re on your own. Your mess, you clean it up” :slight_smile:

6 851 6

Marked As Solved

mikecargal

mikecargal

Mystery solved…

It was “Code Completion” in the SpriteKitHelper::startAnimation(...) { ... SKAction.animate(...) ...} with a withNormalTextures: instead of with:

(How the detective missed that so many times, remains a mystery. He’s on desk duty pending an investigation into his competency.)

Also Liked

mikecargal

mikecargal

I am enjoying the book. I wasn’t really expecting anyone to find my typo for me. (In hindsight, probably biggest “surprise” was that the mistake was something I got wrong so far back and didn’t bit me until this part.

And, based on your endorsement, the detective is back “on the beat”

mikecargal

mikecargal

Here’s a probably hint if anyone is interesting in tossing me a hint.

I went ahead with the code to override the update(_ currentTime: TimeInterval) method, and I do indeed see the level going wild, but I’m not bombarded with gloop drops. (I’m pretty sure that points to what I missed before, but I need to call it a day)

If I find it tomorrow, I’ll update.

Paradox927

Paradox927

Author and Editor at PragProg

Hey, Mike.

Sorry for the delay in getting back to you. Usually, I’m a lot faster at responding to these posts, but this week has proven to be quite the challenge. It seems time was not on my side. :roll_eyes:

On the plus side, it looks like you got everything working—and, for what it’s worth, I think you should keep that detective on the payroll. Everyone deserves a second chance. :blush: :grimacing:

Have a great weekend. Hope you’re enjoying the book.

Popular Prag Prog topics Top

Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
2 1040 0
New
jesse050717
Title: Web Development with Clojure, Third Edition, pg 116 Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
4 1187 4
New
Alexandr
Hi everyone! There is an error on the page 71 in the book “Programming machine learning from coding to depp learning” P. Perrotta. You c...
5 1334 4
New
mikecargal
Title: Hands-On Rust (Chap 8 (Adding a Heads Up Display) It looks like ​.with_simple_console_no_bg​(SCREEN_WIDTH*2, SCREEN_HEIGHT*2...
9 2012 5
New
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
4 1175 3
New
leonW
I ran this command after installing the sample application: $ cards add do something --owner Brian And got a file not found error: Fil...
5 4340 7
New
adamwoolhether
I’m not quite sure what’s going on here, but I’m unable to have to containers successfully complete the Readiness/Liveness checks. I’m im...
5 1391 5
New
AufHe
I’m a newbie to Rails 7 and have hit an issue with the bin/Dev script mentioned on pages 112-113. Iteration A1 - Seeing the list of prod...
0 2609 9
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
1 1015 4
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
1 1043 10
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
144 8222 50
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
10 5357 8
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
82 6614 31
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1126 25188 745
New
New
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
16 3805 11
New
AstonJ
Chris Seaton, the creator of TruffleRuby has died. It appears from suicide :cry: He left this note on Twitter on the weekend: And one...
4 2131 2
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
41 2556 20
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
13 3002 10
New

Latest in PragProg

View all threads ❯