Updating the Display
The HUD is looking great on the screen, but it’s not useful until we can update it with the proper information in real time. We need to be able to add points to the score, start some sort of timer that updates the display of elapsed time, and stop the timer when the game ends. We’ll implement methods for each of these behaviors and call them at the appropriate time in the scene.
Let’s declare these three behaviors as public methods in the RCWHUDNode.h header file.
05-HUD/step03/SpaceRun/RCWHUDNode.h | |
| @interface RCWHUDNode : SKNode |
| - (void)layoutForScene; |
| |
* | - (void)addPoints:(NSInteger)points; |
* | - (void)startGame; |
* | - (void)endGame; |
* | |
| @end |
These methods will let us command and control this node from the scene. ...
Get Build iOS Games with Sprite Kit now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.