PacDessert1436.YZKGame.DualTemplate 1.0.0

dotnet new install PacDessert1436.YZKGame.DualTemplate@1.0.0
                    
This package contains a .NET Template Package you can call from the shell/command line.

YZKGame.NET Dual Template, by Pac-Dessert1436

A dual project template for YZKGame.NET (a WPF-based game engine developed by Yang Zhongke), featuring complete implementations in both C# and VB.NET (current version: 1.0.0).

This is a personal side project created during my preparation for a significant upcoming life commitment (i.e. Postgraduate Entrance Exam). This game template is fully functional and ready for use, but as I focus on this important milestone, active development may be temporarily paused starting in July.

Features

  • Dual Language Support: Complete implementations in both C# and VB.NET
  • Dodge Survival Game Demo: A fully functional game with:
    • Player movement using arrow keys
    • Enemy AI with boundary bouncing
    • Collision detection
    • Progressive difficulty (enemy speeds up based on score)
    • Score tracking and display
    • Title screen, gameplay, and game over states
    • Background music support
  • Ready to Use: All assets included (sprites, images, sounds)

Technical Notes & Workarounds

This template implements several workarounds for known limitations in the YZKGame.NET engine:

  • Sprite Transformation: The GameCore.SetSpriteFlipX and GameCore.SetSpriteFlipY methods are not functional due to an internal casting error (MatrixTransform to ScaleTransform). This template does not use sprite flipping.

  • Dimension Methods: Methods like GameCore.GetGameWidth(), GameCore.GetGameHeight(), GameCore.GetImageWidth(), GameCore.GetImageHeight(), GameCore.GetSpriteWidth(), and GameCore.GetSpriteHeight() consistently return 0. This template uses constant values (GAME_WIDTH, GAME_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT) as a reliable workaround.

  • Visual & Audio Limitations: Sprite animations may fail to render in certain scenarios. Audio playback lacks native looping support, though this can be achieved through manual implementation. This template uses static images for visuals for simplicity and reliability.

Getting Started

Prerequisites

  • .NET 10.0 or later
  • YZKGame.NET NuGet package

Note: YZKGame.NET currently targets .NET 7, but .NET 10 is fully compatible.

Template Configuration

C# Template

  • Short Name: pd1yzkgame
  • Identity: PacDessert1436.YZKGame.CSharp
  • Language: C#

VB.NET Template

  • Short Name: pd1yzkgamevb
  • Identity: PacDessert1436.YZKGame.VisualBasic
  • Language: VB.NET

Installation

# Install the template package
dotnet new install PacDessert1436.YZKGame.DualTemplate

Create a New Project

# C# version
dotnet new pd1yzkgame -n MyYZKGame

# VB.NET version
dotnet new pd1yzkgamevb -n MyYZKGameVB

Build and Run

cd MyYZKGame
dotnet build
dotnet run

Game Controls

Key Action
Arrow Keys Move player
Space Start game
Enter Return to title (after game over)
Escape Exit game

Project Structure

MyYZKGame/
├── .template.config/
│   └── template.json      # Template configuration
├── Images/                # Game images
│   ├── background.png
│   ├── player.png
│   └── enemy.png
├── Sounds/                # Game sounds
│   └── main_theme.mp3
├── Program.cs             # Main game logic (C#)
├── MyYZKGame.csproj       # Project file
└── MyYZKGame.slnx         # Solution file

Game Mechanics

Player Class

  • Singleton pattern for global access
  • Movement with arrow keys
  • Boundary clamping to prevent leaving screen
  • Collision detection with enemies

Enemy Class

  • Singleton pattern for global access
  • Random initial position and direction
  • Automatic boundary bouncing
  • Speed increases with player score (max 10)

Game States

  1. Title: Display game title and instructions
  2. Playing: Gameplay with score tracking
  3. GameOver: Display final score and restart option

Acknowledgments

  • YZKGame.NET by Yang Zhongke
  • Game assets used for demonstration purposes

License

This project is licensed under the MIT License, open source and available for educational purposes.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 136 6/23/2026