Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lex Hann authored and Lex Hann committed Feb 5, 2024
1 parent 2dc4f2c commit 22e8c9d
Show file tree
Hide file tree
Showing 25 changed files with 890 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Asteroid Survival.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34525.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asteroid Survival", "Asteroid Survival\Asteroid Survival.csproj", "{25EBDA58-415A-4677-8DEF-5E863310C9F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25EBDA58-415A-4677-8DEF-5E863310C9F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25EBDA58-415A-4677-8DEF-5E863310C9F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25EBDA58-415A-4677-8DEF-5E863310C9F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25EBDA58-415A-4677-8DEF-5E863310C9F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {82D2258E-6FA9-4CBA-BFCA-9867B0A7F3ED}
EndGlobalSection
EndGlobal
36 changes: 36 additions & 0 deletions Asteroid Survival/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mgcb": {
"version": "3.8.1.303",
"commands": [
"mgcb"
]
},
"dotnet-mgcb-editor": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor"
]
},
"dotnet-mgcb-editor-linux": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-linux"
]
},
"dotnet-mgcb-editor-windows": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-windows"
]
},
"dotnet-mgcb-editor-mac": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-mac"
]
}
}
}
29 changes: 29 additions & 0 deletions Asteroid Survival/Asteroid Survival.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RollForward>Major</RollForward>
<PublishReadyToRun>false</PublishReadyToRun>
<TieredCompilation>false</TieredCompilation>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<None Remove="Icon.ico" />
<None Remove="Icon.bmp" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Icon.ico" />
<EmbeddedResource Include="Icon.bmp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
</ItemGroup>
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
<Message Text="Restoring dotnet tools" Importance="High" />
<Exec Command="dotnet tool restore" />
</Target>
</Project>
Binary file added Asteroid Survival/Content/Audio/Explosion1.wav
Binary file not shown.
Binary file added Asteroid Survival/Content/Audio/Explosion2.wav
Binary file not shown.
Binary file added Asteroid Survival/Content/Audio/Shoot.wav
Binary file not shown.
Binary file added Asteroid Survival/Content/Audio/Start.wav
Binary file not shown.
106 changes: 106 additions & 0 deletions Asteroid Survival/Content/Content.mgcb
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@

#----------------------------- Global Properties ----------------------------#

/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:DesktopGL
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#


#---------------------------------- Content ---------------------------------#

#begin Audio/Explosion1.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Audio/Explosion1.wav

#begin Audio/Explosion2.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Audio/Explosion2.wav

#begin Audio/Shoot.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Audio/Shoot.wav

#begin Audio/Start.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Audio/Start.wav

#begin Fonts/Hyperspace.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:Fonts/Hyperspace.spritefont

#begin Graphics/AsteroidLarge.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Graphics/AsteroidLarge.png

#begin Graphics/AsteroidMedium.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Graphics/AsteroidMedium.png

#begin Graphics/AsteroidSmall.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Graphics/AsteroidSmall.png

#begin Graphics/Bullet.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Graphics/Bullet.png

#begin Graphics/Player.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Graphics/Player.png

60 changes: 60 additions & 0 deletions Asteroid Survival/Content/Fonts/Hyperspace.spritefont
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">

<!--
Modify this string to change the font that will be imported.
-->
<FontName>Hyperspace</FontName>

<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>16</Size>

<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>

<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>

<!--
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
-->
<Style>Regular</Style>

<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<!-- <DefaultCharacter>*</DefaultCharacter> -->

<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>
Binary file added Asteroid Survival/Content/Graphics/AsteroidLarge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Asteroid Survival/Content/Graphics/AsteroidSmall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Asteroid Survival/Content/Graphics/Bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Asteroid Survival/Content/Graphics/Player.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Asteroid Survival/Icon.bmp
Binary file not shown.
Binary file added Asteroid Survival/Icon.ico
Binary file not shown.
96 changes: 96 additions & 0 deletions Asteroid Survival/Source/Animation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using Microsoft.Xna.Framework;

namespace Asteroid_Survival.Source
{
internal class Animation
{
private int _Counter = 0;
private int _CurrentFrame = 0;
private int _CurrentRowPosition = 0;
private int _CurrentColumnPosition = 0;

private readonly int _Padding = 0;
private readonly int _OffsetX = 0;
private readonly int _OffsetY = 0;
private readonly int _NumberOfFrames;
private readonly int _NumberOfColumns;
private readonly int _SizeOfTextures;
private readonly int _Interval;

internal Animation(int numberOfFrames, int numberOfColumns, int sizeOfTextures, int interval)
{
_NumberOfFrames = numberOfFrames;
_NumberOfColumns = numberOfColumns;
_SizeOfTextures = sizeOfTextures;
_Interval = interval;
}

internal Animation(int numberOfFrames, int numberOfColumns, int sizeOfTextures, int interval, int offsetX, int offsetY)
{
_NumberOfFrames = numberOfFrames;
_NumberOfColumns = numberOfColumns;
_SizeOfTextures = sizeOfTextures;
_Interval = interval;
_OffsetX = offsetX;
_OffsetY = offsetY;
}

internal Animation(int numberOfFrames, int numberOfColumns, int sizeOfTextures, int interval, int padding)
{
_NumberOfFrames = numberOfFrames;
_NumberOfColumns = numberOfColumns;
_SizeOfTextures = sizeOfTextures;
_Interval = interval;
_Padding = padding;
}

internal Animation(int numberOfFrames, int numberOfColumns, int sizeOfTextures, int interval, int offsetX, int offsetY, int padding)
{
_NumberOfFrames = numberOfFrames;
_NumberOfColumns = numberOfColumns;
_SizeOfTextures = sizeOfTextures;
_Interval = interval;
_OffsetX = offsetX;
_OffsetY = offsetY;
_Padding = padding;
}

internal void Update()
{
_Counter++;
if (_Counter >= _Interval)
{
_Counter = 0;
NextFrame();
}
}

private void NextFrame()
{
_CurrentFrame++;
_CurrentColumnPosition++;
if (_CurrentFrame >= _NumberOfFrames)
{
Reset();
}

if (_CurrentColumnPosition >= _NumberOfColumns)
{
_CurrentColumnPosition = 0;
_CurrentRowPosition++;
}
}

internal void Reset()
{
_CurrentFrame = 0;
_CurrentColumnPosition = 0;
_CurrentRowPosition = 0;
}

internal Rectangle? CurrentFrame
{
get { return new Rectangle(_CurrentColumnPosition * (_SizeOfTextures + _Padding) + _OffsetX, _CurrentRowPosition * (_SizeOfTextures + _Padding) + _OffsetY, _SizeOfTextures, _SizeOfTextures); }
}
}
}
Loading

0 comments on commit 22e8c9d

Please sign in to comment.