Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5ef038a
creation of planet protectors directory (copied Lost in Space)
charliejhorn Aug 12, 2024
82b16f5
renamed 'planet' to 'asteroid', and changed namespace to 'PlanetProte…
charliejhorn Aug 12, 2024
1907405
removed asteroid.visit property and all references
charliejhorn Aug 12, 2024
f6800fc
added Game._SpawnAsteroids, including random asteroid spawning
charliejhorn Aug 12, 2024
0b90300
Adding X Axis movement
JoshuaR7900 Aug 12, 2024
987bb5a
Cache update
JoshuaR7900 Aug 12, 2024
c26aa2b
laser image
poojadissanayake Aug 13, 2024
4bd9cef
bullet movement with space bar press
poojadissanayake Aug 13, 2024
62bea74
gitignore file
poojadissanayake Aug 13, 2024
e6787fa
added splashkit.log to gitignore
charliejhorn Aug 14, 2024
96e4543
random spawning of asteroids
charliejhorn Aug 14, 2024
46a73fc
asteroid-player collision, removal of extra asteroids, added wasd to …
charliejhorn Aug 15, 2024
4ed6410
hud modifications: added hearts and changed score
charliejhorn Aug 15, 2024
63dcf5d
Collision detection, life display with hearts and game over
poojadissanayake Aug 16, 2024
3e2f41f
changed hearts to deduct from right to left
charliejhorn Aug 16, 2024
a300778
removed white debug sqaure
charliejhorn Aug 16, 2024
aa45646
added parallax background, increased score text size
charliejhorn Aug 16, 2024
5d8a520
recentered score text
charliejhorn Aug 16, 2024
2f00826
score is now directly stored in player, removed gameTimer fuel expiry
charliejhorn Aug 16, 2024
90ebde7
removed currentTime from DrawHUD parameters
charliejhorn Aug 16, 2024
d179f71
renamed all 'meteor' to 'asteroid
charliejhorn Aug 16, 2024
e1899ef
fixed exponential score issue
charliejhorn Aug 16, 2024
a45eade
added .DS_Store to gitignore
charliejhorn Aug 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@
*.exe
*.out
*.app

# splashkit log
games/csharp_games/PlanetProtector/logs/splashkit.log

.DS_Store
Binary file added games/.DS_Store
Binary file not shown.
Binary file added games/csharp_games/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("LostInSpace")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9aa1c4b527ee6199e6b033fd1d2f07c1ddaf218d")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+26961bff007219fa239f8f526b1c7c4e7f907100")]
[assembly: System.Reflection.AssemblyProductAttribute("LostInSpace")]
[assembly: System.Reflection.AssemblyTitleAttribute("LostInSpace")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
349dd11e05248816d3fa64c6f11c4dd1ab2af88bff4dad5f3ae7efcd8a013ec5
5fc109064aafe7bdbee6cafbbf62c512689cde4d514469d1e9661b33b31c824b
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = LostInSpace
build_property.ProjectDir = /Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/
build_property.ProjectDir = /Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"format": 1,
"restore": {
"/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj": {}
"/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj": {}
},
"projects": {
"/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj": {
"/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"projectUniqueName": "/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"projectName": "LostInSpace",
"projectPath": "/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"packagesPath": "/Users/omckeon/.nuget/packages/",
"outputPath": "/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/obj/",
"projectPath": "/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"packagesPath": "/Users/cjhorn/.nuget/packages/",
"outputPath": "/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/omckeon/.nuget/NuGet/NuGet.Config"
"/Users/cjhorn/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
Expand Down Expand Up @@ -64,7 +64,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.302/PortableRuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.303/PortableRuntimeIdentifierGraph.json"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/omckeon/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/omckeon/.nuget/packages/</NuGetPackageFolders>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/cjhorn/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/cjhorn/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.10.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/Users/omckeon/.nuget/packages/" />
<SourceRoot Include="/Users/cjhorn/.nuget/packages/" />
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions games/csharp_games/LostInSpace/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
]
},
"packageFolders": {
"/Users/omckeon/.nuget/packages/": {}
"/Users/cjhorn/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"projectUniqueName": "/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"projectName": "LostInSpace",
"projectPath": "/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"packagesPath": "/Users/omckeon/.nuget/packages/",
"outputPath": "/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/obj/",
"projectPath": "/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"packagesPath": "/Users/cjhorn/.nuget/packages/",
"outputPath": "/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/omckeon/.nuget/NuGet/NuGet.Config"
"/Users/cjhorn/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net8.0"
Expand Down Expand Up @@ -98,7 +98,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.302/PortableRuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.303/PortableRuntimeIdentifierGraph.json"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions games/csharp_games/LostInSpace/obj/project.nuget.cache
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"version": 2,
"dgSpecHash": "YRjUtmP6Yi0=",
"dgSpecHash": "dzn/LKEVpPY=",
"success": true,
"projectFilePath": "/Users/omckeon/Desktop/OLIVIA/4-GitHubRepos/Thoth-Repos/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"projectFilePath": "/Users/cjhorn/code/arcade-hackathon/arcade-hackathon-project/games/csharp_games/LostInSpace/LostInSpace.csproj",
"expectedPackageFiles": [
"/Users/omckeon/.nuget/packages/splashkit/1.1.6/splashkit.1.1.6.nupkg.sha512"
"/Users/cjhorn/.nuget/packages/splashkit/1.1.6/splashkit.1.1.6.nupkg.sha512"
],
"logs": []
}
Binary file added games/csharp_games/PlanetProtector/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions games/csharp_games/PlanetProtector/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ignore /bin and obj
/bin
/obj
Resources/images/.DS_Store
112 changes: 112 additions & 0 deletions games/csharp_games/PlanetProtector/Asteroid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using SplashKitSDK;

namespace PlanetProtector
{
// Asteroid kind enum
enum AsteroidKind
{
MERCURY,
VENUS,
MARS,
JUPITER,
NEPTUNE,
PLUTO
}

public class Asteroid
{
// CONSTANTS
const float ASTEROID_SPEED = 3.5f; // should be 0.5f for final game

// int ASTEROID_KIND_COUNT = 6; // number of entries in the AsteroidKind enum

// need to somehow pass this into the drawing of the sprite
// can use public void Bitmap.DrawBitmap(double x, double y, DrawingOptions opts);
// but that is drawing the bitmap, not drawing the sprite
// DrawingOptions asteroidOptions = SplashKit.OptionRotateBmp(10);

// FIELDS
private Sprite _asteroidSprite;
private bool hitPlayer = false;


// CONSTRUCTOR
public Asteroid(int x, int y)
{
// Randomly set a new asteroids sprite
// _asteroidSprite = new Sprite(_AsteroidBitmap((AsteroidKind)SplashKit.Rnd(ASTEROID_KIND_COUNT)));
_asteroidSprite = new Sprite(SplashKit.BitmapNamed("asteroid"));

//Set asteroid x and y
_asteroidSprite.X = (x - _asteroidSprite.Width) / 2;
_asteroidSprite.Y = (y - _asteroidSprite.Height) / 2;

//Set asteroid velocity and rotation
_asteroidSprite.Dy = ASTEROID_SPEED;
}

// ACCESSORS
// Read-only property to return the asteroid sprite
public Sprite Sprite
{
get { return _asteroidSprite; }
}

public bool HitPlayer
{
get { return hitPlayer; }
}

/**
* -----------------------
* Public Methods
* -----------------------
*/

// Draw the asteroid sprite
public void Draw()
{
_asteroidSprite.Draw();
}

// Update the asteroid sprite
public void Update()
{
_asteroidSprite.Update();
}

// Asteroid has hit player
public void HitsPlayer()
{
hitPlayer = true;
}

/**
* -----------------------
* Private Methods
* -----------------------
*/

// Return Bitmap from Asteroid kind
private Bitmap _AsteroidBitmap(AsteroidKind kind)
{
switch (kind)
{
case AsteroidKind.MERCURY:
return SplashKit.BitmapNamed("mercury");
case AsteroidKind.VENUS:
return SplashKit.BitmapNamed("venus");
case AsteroidKind.MARS:
return SplashKit.BitmapNamed("mars");
case AsteroidKind.JUPITER:
return SplashKit.BitmapNamed("jupiter");
case AsteroidKind.NEPTUNE:
return SplashKit.BitmapNamed("neptune");
case AsteroidKind.PLUTO:
return SplashKit.BitmapNamed("pluto");
default:
return SplashKit.BitmapNamed("mercury");
}
}
}
}
53 changes: 53 additions & 0 deletions games/csharp_games/PlanetProtector/Background.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using SplashKitSDK;

namespace PlanetProtector
{
class Background
{
// Fields
private Bitmap _front;
private Bitmap _rear;
private double _frontY;
private double _rearY;
private double _speed;

// Constructor
public Background()
{
_front = SplashKit.BitmapNamed("background_front");
_rear = SplashKit.BitmapNamed("background_rear");

_frontY = 0;
_rearY = 0;

_speed = 0.8;
}

// Update the background
public void Update()
{
_frontY += _speed * 2;
_rearY += _speed;

if (_frontY >= _front.Height)
{
_frontY = 0;
}

if (_rearY >= _rear.Height)
{
_rearY = 0;
}
}

// Draw the background
public void Draw()
{
SplashKit.DrawBitmap(_rear, 0, _rearY);
SplashKit.DrawBitmap(_rear, 0, _rearY - _rear.Height);

SplashKit.DrawBitmap(_front, 0, _frontY);
SplashKit.DrawBitmap(_front, 0, _frontY - _front.Height);
}
}
}
48 changes: 48 additions & 0 deletions games/csharp_games/PlanetProtector/Bullet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using SplashKitSDK;

namespace PlanetProtector
{
public class Bullet
{
// Fields
private Sprite _bulletSprite;

// Constructor
public Bullet(double x, double y)
{
// Load the bullet bitmap and create the sprite
_bulletSprite = SplashKit.CreateSprite(SplashKit.BitmapNamed("bullet"));
_bulletSprite.X = (float)x;
_bulletSprite.Y = (float)y;

_bulletSprite.Rotation = 270;
}

// Read-only property to access the bullet sprite
public Sprite Sprite
{
get
{
return _bulletSprite;
}
}

// Update the bullet's position
public void Update()
{
_bulletSprite.Y -= 10; // Move bullet up the screen
}

// Draw the bullet
public void Draw()
{
_bulletSprite.Draw();
}

// Check if the bullet is off-screen
public bool IsOffScreen(Window gameWindow)
{
return _bulletSprite.Y < -_bulletSprite.Height;
}
}
}
Loading