Skip to content

Commit

Permalink
Merge pull request #19 from Imaginos16/new-player-model
Browse files Browse the repository at this point in the history
Adds a Placeholder Player Model
  • Loading branch information
MarkSuckerberg authored Jun 5, 2024
2 parents d824acd + 12951c4 commit 49a3dd2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Blocktest/Code/Networking/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void PeerConnected(NetPeer peer) {
Console.WriteLine($"Connected to server {peer.Address}:{peer.Port} as {peer.RemoteId}");

Transform newTransform = new(new Vector2Int(256, 128));
Renderable newRenderable = new(newTransform, Layer.Player, Drawable.ErrorDrawable, Color.Orange);
Renderable newRenderable = new(newTransform, Layer.Player, Drawable.PlaceholderDrawable);
LocalWorldState.PlayerPositions.Add(peer.RemoteId, newTransform);
_playerRenderables.Add(peer.RemoteId, newRenderable);
_camera.RenderedComponents.Add(newRenderable);
Expand Down Expand Up @@ -96,7 +96,7 @@ protected override void HandleEvent(PeerEvent peerEvent) {
Console.WriteLine("New player connected");

Transform newTransform = new(new Vector2Int(256, 128));
Renderable newRenderable = new(newTransform, Layer.Player, Drawable.ErrorDrawable, Color.Orange);
Renderable newRenderable = new(newTransform, Layer.Player, Drawable.PlaceholderDrawable);
LocalWorldState.PlayerPositions.Add(peerEvent.SourceId, newTransform);
_playerRenderables.Add(peerEvent.SourceId, newRenderable);
_camera.RenderedComponents.Add(newRenderable);
Expand Down
3 changes: 2 additions & 1 deletion Blocktest/Code/Rendering/Drawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public Drawable(string fileName, Rectangle? bounds = null) {
}

public static Drawable ErrorDrawable { get; } = new(@"Graphics\Blocks\error");

public static Drawable PlaceholderDrawable { get; } = new(@"Graphics\Player\placeholder-base");

public void Draw(RenderContext context, Rectangle dest, Color color) {
context.Draw(Texture, dest, Bounds, color);
}
Expand Down
2 changes: 1 addition & 1 deletion Blocktest/Code/Scenes/GameScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public GameScene(BlocktestGame game, bool doConnect, IPEndPoint? ip) {

//Add player to world in singleplayer
Transform newTransform = new(new Vector2Int(256, 128));
Renderable newRenderable = new(newTransform, Layer.Player, Drawable.ErrorDrawable, Color.Orange);
Renderable newRenderable = new(newTransform, Layer.Player, Drawable.PlaceholderDrawable);
_worldState.PlayerPositions.Add(0, newTransform);
_camera.RenderedComponents.Add(newRenderable);

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 49a3dd2

Please sign in to comment.