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:

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.

Where Next?

Popular Pragmatic Bookshelf topics Top

johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
New
telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
Charles
In general, the book isn’t yet updated for Phoenix version 1.6. On page 18 of the book, the authors indicate that an auto generated of ro...
New
jwandekoken
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below: d...
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New

Other popular topics Top

Exadra37
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New

Sub Categories: