diff options
| author | Sarah Bradley <git@sarahduck.ca> | 2023-12-18 19:51:26 -0800 |
|---|---|---|
| committer | Sarah Bradley <git@sarahduck.ca> | 2023-12-18 19:51:26 -0800 |
| commit | 4b7966ffda3b6ad34d355148ddccbe2959061730 (patch) | |
| tree | 8be290357abb5d7cf8c72a803f3be63b3e353d7e /Oneko.cs | |
| parent | fc3874657348bde6ce7e3fab625c92dfec91baaa (diff) | |
Networked Mice!!
Also combined Spritesheet + Username packets into one UserInfo packet.
Diffstat (limited to 'Oneko.cs')
| -rw-r--r-- | Oneko.cs | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -19,7 +19,7 @@ class Oneko : Drawable public string Name = "Oneko"; - public Oneko() + public Oneko() : base() { Size = new(32,32); Position = new(320/2, 240/2); @@ -32,27 +32,21 @@ class Oneko : Drawable Console.WriteLine("Path to spritesheet was invalid, using the default."); SpriteSheet = Bitmap.FromPNGMemory(EmbeddedResources.GetResource("nekos.oneko.png")); } - - Drawables.Add(this); } - public Oneko(Bitmap spriteSheet) + public Oneko(Bitmap spriteSheet) : base() { Size = new(32,32); Position = new(0, 0); SpriteSheet = spriteSheet; - - Drawables.Add(this); } public override void Draw() { //Nametag - if (Vector2.Distance(Raylib.GetMousePosition()/OnekoOnline.WindowScale, Position) < 20f) { - Vector2 NametagPosition = new(Position.X-(Name.Length*3)+4, Position.Y-28); - Raylib.DrawTextEx(OnekoOnline.DefaultFont, Name, NametagPosition+Directions.Down, 11, 0, Color.BLACK); //Shadow - Raylib.DrawTextEx(OnekoOnline.DefaultFont, Name, NametagPosition, 11, 0, Color.WHITE); - } + Vector2 NametagPosition = new(Position.X-(Name.Length*3)+4, Position.Y-28); + Raylib.DrawTextEx(OnekoOnline.DefaultFont, Name, NametagPosition+Directions.Down, 11, 0, Color.BLACK); //Shadow + Raylib.DrawTextEx(OnekoOnline.DefaultFont, Name, NametagPosition, 11, 0, Color.WHITE); //The neko Raylib.DrawTexturePro(SpriteSheet.Texture, Animation.GetFrame(Frame), new Rectangle(Position.X, Position.Y, Size.X, Size.Y), Size/2, Rotation, Color.WHITE); @@ -88,7 +82,7 @@ class Oneko : Drawable public override void Dispose() { SpriteSheet.Dispose(); - Drawables.Remove(this); + base.Dispose(); } struct OnekoAnimation(Rectangle frame1, Rectangle frame2) |
