New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/rendering multiplayer #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, but the rest LGTM!
I think this is a really elegant solution, that required a lot of understanding of MetalKit and SpriteKit :)
guard let player = self.player else { | ||
return | ||
} | ||
self.position = player.position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the camera only follow the x position of the player?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By doing so, we need to initialize y position of camera to half of the height of the scene.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed it was previously only tracking the x position, but the player may jump up to higher platforms and exit the height of what the view can see...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm that's true. My rationale for fixing the camera's y position was because if the camera track's the player's y position as well, then we may run out of the background image when going up. I guess it can be said that levels should not be limited in height (maybe can have a level that's focused in the sky or something), but with the lack of assets, would it be better to just cap how high the player can go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we resolve this after we have a complete level ready? We can test then what feels most normal/natural. We can create an issue in the meantime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay that sounds good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Local Multiplayer Rendering
Closes #23
Changes
LayoutUtils
for creating layout for player viewsGameScene
now creates a camera that tracks the player as it movesGameBridge
to synchronise player entities toGameScene
Preview