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:

1 Like