mikecargal

mikecargal

Apple Game Frameworks and Technologies:

Title: Name of book: description (page number)

Why isn’t:

if let localPlayer = gameCenterData?.getLocalPlayer() {
  if let index = gameCenterData?.getPlayerIndex(for: localPlayer) {
    gameCenterData?.players[index].totalPoints =
      gameModel.players[0].totalPoints
}
// Update the remote player's stats
if let remotePlayer = gameCenterData?.getRemotePlayer() {
  if let index = gameCenterData?.getPlayerIndex(for: remotePlayer) {
    gameCenterData?.players[index].totalPoints =
      gameModel.players[1].totalPoints
} 

just:

// Update the local player's stats
if let localPlayer = gameCenterData?.getLocalPlayer() {
   localPlayer.totalPoints = gameModel.players[0].totalPoints
}
// Update the remote player's stats
if let remotePlayer = gameCenterData?.getRemotePlayer() {
    remotePlayer.totalPoints = gameModel.players[1].totalPoints
} 

Am I missing something special that’s accomplished by getting the index and then indexing back into players to get to the same player???

Popular Pragmatic Bookshelf 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...
New
brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
jeffmcompsci
Title: Design and Build Great Web APIs - typo “https://company-atk.herokuapp.com/2258ie4t68jv” (page 19, third bullet in URL list) Typo:...
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
AleksandrKudashkin
On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New
alanq
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
jeremyhuiskamp
Title: Web Development with Clojure, Third Edition, vB17.0 (p9) The create table guestbook syntax suggested doesn’t seem to be accepted ...
New
patoncrispy
I’m new to Rust and am using this book to learn more as well as to feed my interest in game dev. I’ve just finished the flappy dragon exa...
New
digitalbias
Title: Build a Weather Station with Elixir and Nerves: Problem connecting to Postgres with Grafana on (page 64) If you follow the defau...
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...
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
New
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
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
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
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
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
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
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New

Latest in Apple Game Frameworks and Technologies

Apple Game Frameworks and Technologies Portal