Commit ad53ee46 authored by Stefan Schwab's avatar Stefan Schwab

added project

parent 264c5ee2
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
*.physicsMaterial2D merge=unityyamlmerge eol=lf
*.physicsMaterial merge=unityyamlmerge eol=lf
*.asset merge=unityyamlmerge eol=lf
*.meta merge=unityyamlmerge eol=lf
*.controller merge=unityyamlmerge eol=lf
## git-lfs ##
#Image
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.ai filter=lfs diff=lfs merge=lfs -text
#Audio
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
#Video
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
#3D Object
*.FBX filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
#ETC
*.a filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.unitypackage filter=lfs diff=lfs merge=lfs -text
*.aif filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.rns filter=lfs diff=lfs merge=lfs -text
*.reason filter=lfs diff=lfs merge=lfs -text
*.lxo filter=lfs diff=lfs merge=lfs -text
#UnityLightData
LightingData.asset filter=lfs diff=lfs merge=lfs -text
# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
ExportedObj/
*.svd
*.userprefs
*.csproj
*.pidb
*.suo
*.sln
*.user
*.unityproj
*.booproj
*.tmp
**/.vs/
# ============ #
# OS generated #
# ============ #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
\ No newline at end of file
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:Windows
/config:
/profile:Reach
/compress:False
#-------------------------------- References --------------------------------#
#---------------------------------- Content ---------------------------------#
#begin Audio/sizzle.mp3
/importer:Mp3Importer
/processor:SongProcessor
/processorParam:Quality=Best
/build:Audio/sizzle.mp3
#begin Images/LavaTile.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:Images/LavaTile.png
#begin Images/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:Images/player.png
#begin Font/Arial.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:Font/Arial.spritefont
<?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>Arial</FontName>
<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>32</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>
<?xml version="1.0" encoding="utf-8"?>
<SourceFileCollection xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Profile>Reach</Profile>
<Platform>Windows</Platform>
<Config />
<SourceFiles>
<File>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/Audio/sizzle.mp3</File>
<File>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/Images/LavaTile.png</File>
<File>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/Images/player.png</File>
<File>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/Font/Arial.spritefont</File>
</SourceFiles>
</SourceFileCollection>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<PipelineBuildEvent xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SourceFile>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/Audio/sizzle.mp3</SourceFile>
<SourceTime>2020-03-30T16:35:04+02:00</SourceTime>
<DestFile>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/bin/Windows/Audio/sizzle.xnb</DestFile>
<DestTime>2020-03-31T23:46:30.9412771+02:00</DestTime>
<Importer>Mp3Importer</Importer>
<ImporterTime>2017-03-01T16:05:36+01:00</ImporterTime>
<Processor>SongProcessor</Processor>
<ProcessorTime>2017-03-01T16:05:36+01:00</ProcessorTime>
<Parameters>
<Key>Quality</Key>
<Value>Best</Value>
</Parameters>
<Dependencies />
<BuildAsset />
<BuildOutput>
<string>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/bin/Windows/Audio/sizzle.wma</string>
</BuildOutput>
</PipelineBuildEvent>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<PipelineBuildEvent xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SourceFile>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/Font/Arial.spritefont</SourceFile>
<SourceTime>2020-03-31T23:50:01.6729204+02:00</SourceTime>
<DestFile>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/bin/Windows/Font/Arial.xnb</DestFile>
<DestTime>2020-03-31T23:50:07.5720948+02:00</DestTime>
<Importer>FontDescriptionImporter</Importer>
<ImporterTime>2017-03-01T16:05:36+01:00</ImporterTime>
<Processor>FontDescriptionProcessor</Processor>
<ProcessorTime>2017-03-01T16:05:36+01:00</ProcessorTime>
<Parameters>
<Key>PremultiplyAlpha</Key>
<Value>True</Value>
</Parameters>
<Parameters>
<Key>TextureFormat</Key>
<Value>Compressed</Value>
</Parameters>
<Dependencies />
<BuildAsset />
<BuildOutput />
</PipelineBuildEvent>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<PipelineBuildEvent xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SourceFile>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/Images/LavaTile.png</SourceFile>
<SourceTime>2020-03-30T16:32:50+02:00</SourceTime>
<DestFile>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/bin/Windows/Images/LavaTile.xnb</DestFile>
<DestTime>2020-03-31T23:46:31.2584358+02:00</DestTime>
<Importer>TextureImporter</Importer>
<ImporterTime>2017-03-01T16:05:36+01:00</ImporterTime>
<Processor>TextureProcessor</Processor>
<ProcessorTime>2017-03-01T16:05:36+01:00</ProcessorTime>
<Parameters>
<Key>ColorKeyColor</Key>
<Value>255,0,255,255</Value>
</Parameters>
<Parameters>
<Key>ColorKeyEnabled</Key>
<Value>True</Value>
</Parameters>
<Parameters>
<Key>GenerateMipmaps</Key>
<Value>False</Value>
</Parameters>
<Parameters>
<Key>PremultiplyAlpha</Key>
<Value>True</Value>
</Parameters>
<Parameters>
<Key>ResizeToPowerOfTwo</Key>
<Value>False</Value>
</Parameters>
<Parameters>
<Key>MakeSquare</Key>
<Value>False</Value>
</Parameters>
<Parameters>
<Key>TextureFormat</Key>
<Value>Color</Value>
</Parameters>
<Dependencies />
<BuildAsset />
<BuildOutput />
</PipelineBuildEvent>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<PipelineBuildEvent xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SourceFile>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/Images/player.png</SourceFile>
<SourceTime>2020-03-30T17:08:04+02:00</SourceTime>
<DestFile>D:/Arbeit/LBA FH Salzburg/Sample_Projekt/monogame_template/First_Monogame/First_Monogame/Content/bin/Windows/Images/player.xnb</DestFile>
<DestTime>2020-03-31T23:46:31.3082949+02:00</DestTime>
<Importer>TextureImporter</Importer>
<ImporterTime>2017-03-01T16:05:36+01:00</ImporterTime>
<Processor>TextureProcessor</Processor>
<ProcessorTime>2017-03-01T16:05:36+01:00</ProcessorTime>
<Parameters>
<Key>ColorKeyColor</Key>
<Value>255,0,255,255</Value>
</Parameters>
<Parameters>
<Key>ColorKeyEnabled</Key>
<Value>True</Value>
</Parameters>
<Parameters>
<Key>GenerateMipmaps</Key>
<Value>False</Value>
</Parameters>
<Parameters>
<Key>PremultiplyAlpha</Key>
<Value>True</Value>
</Parameters>
<Parameters>
<Key>ResizeToPowerOfTwo</Key>
<Value>False</Value>
</Parameters>
<Parameters>
<Key>MakeSquare</Key>
<Value>False</Value>
</Parameters>
<Parameters>
<Key>TextureFormat</Key>
<Value>Color</Value>
</Parameters>
<Dependencies />
<BuildAsset />
<BuildOutput />
</PipelineBuildEvent>
\ No newline at end of file
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace First_Monogame
{
/// <summary>
/// This is the main type for your game.
/// </summary>
public class Game : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D playerTexture;
Texture2D lavaTexture;
Vector2 playerSpawnPos = new Vector2(50, 50);
Vector2 playerPos = new Vector2(50, 50);
Vector2 lavaPos = new Vector2(200, 200);
Rectangle playerAnimationRect = new Rectangle(0, 0, 100, 100);
Vector2 playerAnimationTilling = new Vector2(10,8);
int animationType = 0;
float animationIndex = 0;
float animationSpeed = 0.2f;
SpriteFont arialFont;
int deathCounter = 0;
Rectangle playerRectCollider;
Rectangle lavaRectCollider;
float playerSpeed = 200;
Song burnSound;
public Game()
{
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1024;
graphics.PreferredBackBufferHeight = 768;
graphics.ApplyChanges();
Content.RootDirectory = "Content";
}
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
deathCounter = 0;
RespawnPlayer();
playerRectCollider = playerAnimationRect;
lavaRectCollider = new Rectangle((int)lavaPos.X,(int)lavaPos.Y, lavaTexture.Width,lavaTexture.Height);
}
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
// TODO: use this.Content to load your game content here
playerTexture = Content.Load<Texture2D>("Images/player");
playerAnimationRect = new Rectangle(0, 0, (int)(playerTexture.Width / playerAnimationTilling.X), (int)(playerTexture.Height / playerAnimationTilling.Y));
lavaTexture = Content.Load<Texture2D>("Images/LavaTile");
burnSound = Content.Load<Song>("Audio/sizzle");
arialFont = Content.Load<SpriteFont>("Font/Arial");
}
/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// game-specific content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
// TODO: Add your update logic here
float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
//Console.WriteLine(deltaTime);
MovePlayer(deltaTime);
playerRectCollider.X = (int)playerPos.X;
playerRectCollider.Y = (int)playerPos.Y;
if (playerRectCollider.Intersects(lavaRectCollider))
{
// collision
if(MediaPlayer.State != MediaState.Playing)
MediaPlayer.Play(burnSound);
deathCounter++;
RespawnPlayer();
}
base.Update(gameTime);
}
private void RespawnPlayer()
{
playerPos = playerSpawnPos;
}
private void MovePlayer(float deltatime)
{
if (animationType == 7)
{
animationType = 3;
}
if (animationType == 5)
{
animationType = 1;
}
if (animationType == 4)
{
animationType = 0;
}
if (animationType == 6)
{
animationType = 2;
}
if (Keyboard.GetState().IsKeyDown(Keys.D))
{
playerPos.X+= playerSpeed* deltatime;
animationType = 7;
}
if (Keyboard.GetState().IsKeyDown(Keys.A))
{
playerPos.X-= playerSpeed * deltatime;
animationType = 5;
}
if (Keyboard.GetState().IsKeyDown(Keys.S))
{
playerPos.Y+= playerSpeed* deltatime;
animationType = 4;
}
if (Keyboard.GetState().IsKeyDown(Keys.W))
{
playerPos.Y-= playerSpeed* deltatime;
animationType = 6;
}
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
DoAnimation();
spriteBatch.Begin();
spriteBatch.Draw(playerTexture, playerPos, playerAnimationRect, Color.White);
spriteBatch.Draw(lavaTexture, lavaPos, Color.White);
spriteBatch.DrawString(arialFont, "You died "+deathCounter+" times",new Vector2(20,20),Color.Orange);
spriteBatch.End();
base.Draw(gameTime);
}
private void DoAnimation()
{
animationIndex += animationSpeed;
if (animationType == 0)
{
if (animationIndex > 2)
{
animationIndex = 0;
}
}else if (animationType == 1)
{
if (animationIndex > 2)
{
animationIndex = 0;
}
}else if (animationType == 2)
{
if (animationIndex > 0)
{
animationIndex = 0;
}
}else if (animationType == 3)
{
if (animationIndex > 2)
{
animationIndex = 0;
}
}
else
{
if (animationIndex > 10)
{
animationIndex = 0;
}
}
playerAnimationRect = new Rectangle((int)animationIndex* playerAnimationRect.Width, animationType * playerAnimationRect.Height, playerAnimationRect.Width, playerAnimationRect.Height);
}
}
}
using System;
namespace First_Monogame
{
#if WINDOWS || LINUX
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
using (var game = new Game())
game.Run();
}
}
#endif
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("First_Monogame")]
[assembly: AssemblyProduct("First_Monogame")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8f8923ca-a380-4f6b-bff3-205a69ef5a4c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="First_Monogame"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on and is
is designed to work with. Uncomment the appropriate elements and Windows will