skellt

skellt

Apple Game Frameworks and Technologies: Misleading explanation of gloop end pos (p 62)

On page 62, right after the code snippet for func drop(dropSpeed: TimeInterval, floorLevel: CGFloat), is this line:

Here, you’re setting the initial position of the drop.

As the first explanatory line of text following the method it appears to be referring to the first line of code in the method: let pos = CGPoint(x: position.x, y: floorLevel). But this line is not setting the initial position of the drop. It is setting the end position of the drop to which it will animate. The drop starts up at the top of the screen and animates down to floorLevel.

The initial position of the drop is set elsewhere in spawnGloop(), which then calls drop.

Marked As Solved

Paradox927

Paradox927

Author and Editor at PragProg

Hi, David.

Thank you for pointing this out. I’ve updated the explanation, which will be made available in the next release.

However, for those reading now, the updated explanation reads as follows:

Here, you’re setting the end position of the drop; in other words, where you want the drop to land.

I also expanded the step-by-step that goes along with it—the updates noted in bold text:

  • First, you set the y-position using the input value stored in floorLevel.
  • Then, you add two scale actions to make the drop stretch a little; this gives it a drip-like > appearance.
  • Next, you create actions to fade-in and move the drop down the scene.
  • Finally, for some more visual appeal, you tweak the scale of the drop, and then run this sequence of actions. You give it a named key so that you can access this action later using its name.

Again, thanks for the feedback.

Where Next?

Popular Pragmatic Bookshelf topics Top

New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex> product = %Product{} %Pento....
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
New
AndyDavis3416
@noelrappin Running the webpack dev server, I receive the following warning: ERROR in tsconfig.json TS18003: No inputs were found in c...
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
taguniversalmachine
It seems the second code snippet is missing the code to set the current_user: current_user: Accounts.get_user_by_session_token(session["...
New
creminology
Skimming ahead, much of the following is explained in Chapter 3, but new readers (like me!) will hit a roadblock in Chapter 2 with their ...
New

Other popular topics Top

Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
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
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
New

Sub Categories: