-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more levels, track deaths and time
Implement goals Add a non-arial font for UI Add all direction spikes Add a victory screen Add a jump sound effect Add a README
- Loading branch information
1 parent
c34b772
commit ef8f15c
Showing
34 changed files
with
647 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Microsoft.Xna.Framework; | ||
using Swing.Engine; | ||
using Swing.Screens; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using tainicom.Aether.Physics2D.Dynamics; | ||
using tainicom.Aether.Physics2D.Dynamics.Contacts; | ||
|
||
namespace Swing.Actors | ||
{ | ||
class Goal : BodiedActor | ||
{ | ||
public Goal(Vector2 position, int sideLength) : base(position) | ||
{ | ||
Body = MainGame.Instance.World.CreateRectangle(sideLength / (MainGame.PhysicsScale * 2), | ||
sideLength / (MainGame.PhysicsScale * 2), 20, Position / sideLength / MainGame.PhysicsScale); | ||
Body.OnCollision += Body_OnCollision; | ||
foreach (Fixture f in Body.FixtureList) | ||
{ | ||
f.IsSensor = true; | ||
} | ||
} | ||
|
||
private bool Body_OnCollision(Fixture sender, Fixture other, Contact contact) | ||
{ | ||
if (other.Tag is ColliderTags tag) | ||
{ | ||
if (tag == ColliderTags.Player) | ||
{ | ||
if (Screen is MainGameScreen mgs) | ||
{ | ||
if (MainGameScreen.LevelExists(mgs.Level + 1)) | ||
{ | ||
Screen.ScreenManager.QueueAddScreen(new MainGameScreen(mgs.Level + 1)); | ||
mgs.ExitScreen(); | ||
} | ||
else | ||
{ | ||
Screen.ScreenManager.QueueAddScreen(new VictoryScreen()); | ||
} | ||
} | ||
else | ||
{ | ||
Debug.LogError($"Goal expected to be on a MainGameScreen, was on a {Screen.GetType()}"); | ||
} | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Microsoft.Xna.Framework; | ||
using Swing.Engine.Actors.UI; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Swing.Actors | ||
{ | ||
public class RunTimeDisplay : TextRenderer | ||
{ | ||
public static readonly string format = "hh\\:mm\\:ss\\.ff"; | ||
public RunTimeDisplay(Vector2 position) : base(position, "") | ||
{ | ||
|
||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
text = MainGame.Instance.RunTime.ToString(format); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>Russo One</FontName> | ||
|
||
<!-- | ||
Size is a float value, measured in points. Modify this value to change | ||
the size of the font. | ||
--> | ||
<Size>48</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> </Start> | ||
<End>~</End> | ||
</CharacterRegion> | ||
</CharacterRegions> | ||
</Asset> | ||
</XnaContent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="30" height="17" tilewidth="64" tileheight="64" infinite="0" nextlayerid="2" nextobjectid="1"> | ||
<tileset firstgid="1"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,1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,1,1,1,1, | ||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 | ||
</data> | ||
</layer> | ||
</map> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="30" height="17" tilewidth="64" tileheight="64" infinite="0" nextlayerid="2" nextobjectid="1"> | ||
<tileset firstgid="1" source="../Tileset.tsx"/> | ||
<layer id="1" name="Tile Layer 1" width="30" height="17"> | ||
<data encoding="csv"> | ||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | ||
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, | ||
1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, | ||
1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, | ||
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, | ||
1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, | ||
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, | ||
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, | ||
1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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