SzarkEngine 1.0.5
dotnet add package SzarkEngine --version 1.0.5
NuGet\Install-Package SzarkEngine -Version 1.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SzarkEngine" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SzarkEngine --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SzarkEngine, 1.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SzarkEngine as a Cake Addin #addin nuget:?package=SzarkEngine&version=1.0.5 // Install SzarkEngine as a Cake Tool #tool nuget:?package=SzarkEngine&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Getting Starting Example (Pong)
using System;
using Szark;
namespace Example
{
class PongExample : SzarkEngine
{
private const float playerSpeed = 500;
private const float enemyDifficulty = 4;
private float playerY, enemyY;
private Vector ballPos, ballVel;
private int playerScore, enemyScore;
private bool ballShot;
private Sprite paddle, line, ball;
PongExample() : base("Pong Example",
1280, 720) { }
protected override void Start()
{
paddle = new Sprite(16, 128);
paddle.ClearToColor(Color.White);
line = new Sprite(8, Height);
line.ClearToColor(Color.White);
ball = new Sprite(16, 16);
ball.ClearToColor(Color.White);
}
protected override void Update(float deltaTime)
{
/* Player Code */
playerY += deltaTime * playerSpeed *
(Input.GetKey("W") ? 1 : Input.GetKey("S") ? -1 : 0);
playerY = Mathf.Clamp(playerY, -Height + 144, Height - 144);
if (!ballShot && Input.GetKeyDown("Space"))
{
ballShot = true;
ballVel.x = 800;
ballVel.y = new Random().Next(-800, 800);
}
/* Enemy Code */
enemyY = Mathf.Lerp(enemyY, ballPos.y, enemyDifficulty * deltaTime);
enemyY = Mathf.Clamp(enemyY, -Height + 144, Height - 144);
/* Ball Code */
ballPos += ballVel * deltaTime;
ballPos.x = ballShot ? ballPos.x : -Width + 128;
ballPos.y = ballShot ? ballPos.y : playerY;
if (ballPos.y > Height - 16 || ballPos.y < -Height + 16)
ballVel.y *= -1;
bool hitEnemyPaddle = ballPos.y < enemyY + 128 &&
ballPos.y > enemyY - 128 && ballPos.x > Width - 88;
bool hitPlayerPaddle = ballPos.y < playerY + 128 &&
ballPos.y > playerY - 128 && ballPos.x < -Width + 88;
if (hitEnemyPaddle || hitPlayerPaddle)
{
ballVel.x *= -1;
ballVel.y += new Random().Next(-250, 250);
}
if (ballPos.x > Width)
{
ballShot = false;
playerScore++;
Debug.Log("Player Scored!");
Debug.Log($"{playerScore} | {enemyScore}");
}
if (ballPos.x < -Width)
{
ballShot = false;
enemyScore++;
Debug.Log("Enemy Scored!");
Debug.Log($"{playerScore} | {enemyScore}");
}
}
protected override void Draw(float deltaTime)
{
paddle.Render(-Width + 64, playerY);
paddle.Render(Width - 64, enemyY);
ball.Render(ballPos.x, ballPos.y);
line.Render(0, 0);
}
protected override void Destroyed() { }
static void Main() => new PongExample();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 2.1
- CoreCompat.System.Drawing (>= 1.0.0-beta006)
- Microsoft.NETCore.App (>= 2.1.0)
- OpenTK.NETCore (>= 1.1.2749.6433)
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.5 | 584 | 4/13/2019 |