part 1: movement
This commit is contained in:
parent
e4d5cb8c9b
commit
a8dcbd7758
18 changed files with 400 additions and 0 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
bin/
|
||||
obj/
|
||||
/packages/
|
||||
riderModule.iml
|
||||
/_ReSharper.Caches/
|
||||
.idea
|
16
GreatSpringGameJam.sln
Normal file
16
GreatSpringGameJam.sln
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreatSpringGameJam", "GreatSpringGameJam\GreatSpringGameJam.csproj", "{788D2084-3F31-4331-9870-B5F01F79E7B0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{788D2084-3F31-4331-9870-B5F01F79E7B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{788D2084-3F31-4331-9870-B5F01F79E7B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{788D2084-3F31-4331-9870-B5F01F79E7B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{788D2084-3F31-4331-9870-B5F01F79E7B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
31
GreatSpringGameJam/Content/Content.mgcb
Normal file
31
GreatSpringGameJam/Content/Content.mgcb
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
#----------------------------- Global Properties ----------------------------#
|
||||
|
||||
/outputDir:bin
|
||||
/intermediateDir:obj
|
||||
/platform:DesktopGL
|
||||
/config:
|
||||
/profile:Reach
|
||||
/compress:False
|
||||
|
||||
#-------------------------------- References --------------------------------#
|
||||
|
||||
/reference:..\..\packages\monogame.extended.content.pipeline\3.8.0\tools\MonoGame.Extended.Content.Pipeline.dll
|
||||
|
||||
#---------------------------------- Content ---------------------------------#
|
||||
|
||||
#begin Maps/Level1.tmx
|
||||
/importer:TiledMapImporter
|
||||
/processor:TiledMapProcessor
|
||||
/build:Maps/Level1.tmx
|
||||
|
||||
#begin Tilesets/World.tsx
|
||||
/importer:TiledMapTilesetImporter
|
||||
/processor:TiledMapTilesetProcessor
|
||||
/build:Tilesets/World.tsx
|
||||
|
||||
#begin Textures/Player.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/build:Textures/Player.png
|
||||
|
8
GreatSpringGameJam/Content/Contentless.json
Normal file
8
GreatSpringGameJam/Content/Contentless.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"exclude": [
|
||||
"obj/",
|
||||
"bin/",
|
||||
"Palettes/",
|
||||
"Tilesets/*.png"
|
||||
]
|
||||
}
|
38
GreatSpringGameJam/Content/Maps/Level1.tmx
Normal file
38
GreatSpringGameJam/Content/Maps/Level1.tmx
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.4" tiledversion="1.4.3" orientation="orthogonal" renderorder="right-down" width="100" height="30" tilewidth="16" tileheight="16" infinite="0" nextlayerid="2" nextobjectid="1">
|
||||
<tileset firstgid="1" source="../Tilesets/World.tsx"/>
|
||||
<layer id="1" name="Tile Layer 1" width="100" height="30">
|
||||
<data encoding="csv">
|
||||
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,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,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,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,0,0,0,0,0,0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,10,10,10,10,10,10,10,11,0,0,0,9,10,10,10,10,10,10,11,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
10,10,10,10,10,10,10,10,10,10,11,0,0,1,5,10,10,10,10,10,10,11,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
10,10,10,10,10,10,10,10,10,10,11,0,0,9,10,10,10,10,10,10,10,11,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
10,10,10,10,10,10,10,10,10,10,4,3,0,9,10,10,10,10,10,10,10,11,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
BIN
GreatSpringGameJam/Content/Palettes/skedd16-1x.png
Normal file
BIN
GreatSpringGameJam/Content/Palettes/skedd16-1x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 155 B |
BIN
GreatSpringGameJam/Content/Textures/Player.aseprite
Normal file
BIN
GreatSpringGameJam/Content/Textures/Player.aseprite
Normal file
Binary file not shown.
BIN
GreatSpringGameJam/Content/Textures/Player.png
Normal file
BIN
GreatSpringGameJam/Content/Textures/Player.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 487 B |
BIN
GreatSpringGameJam/Content/Tilesets/World.aseprite
Normal file
BIN
GreatSpringGameJam/Content/Tilesets/World.aseprite
Normal file
Binary file not shown.
BIN
GreatSpringGameJam/Content/Tilesets/World.png
Normal file
BIN
GreatSpringGameJam/Content/Tilesets/World.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 670 B |
44
GreatSpringGameJam/Content/Tilesets/World.tsx
Normal file
44
GreatSpringGameJam/Content/Tilesets/World.tsx
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.4" tiledversion="1.4.3" name="World" tilewidth="16" tileheight="16" tilecount="64" columns="8">
|
||||
<image source="World.png" width="128" height="128"/>
|
||||
<tile id="0">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="1">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="2">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="3">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="4">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="8">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="9">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="10">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
</tileset>
|
22
GreatSpringGameJam/Entity.cs
Normal file
22
GreatSpringGameJam/Entity.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace GreatSpringGameJam {
|
||||
public class Entity {
|
||||
|
||||
public readonly Map Map;
|
||||
public Vector2 Position;
|
||||
|
||||
public Entity(Map map, Vector2 position) {
|
||||
this.Map = map;
|
||||
this.Position = position;
|
||||
}
|
||||
|
||||
public virtual void Update(GameTime time) {
|
||||
}
|
||||
|
||||
public virtual void Draw(GameTime time, SpriteBatch batch) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
48
GreatSpringGameJam/GameImpl.cs
Normal file
48
GreatSpringGameJam/GameImpl.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using MLEM.Cameras;
|
||||
using MLEM.Startup;
|
||||
|
||||
namespace GreatSpringGameJam {
|
||||
public class GameImpl : MlemGame {
|
||||
|
||||
public static GameImpl Instance { get; private set; }
|
||||
public Map Map { get; private set; }
|
||||
public Player Player { get; private set; }
|
||||
private Camera camera;
|
||||
|
||||
public GameImpl() {
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void LoadContent() {
|
||||
this.GraphicsDeviceManager.PreferredBackBufferWidth = 1280;
|
||||
this.GraphicsDeviceManager.PreferredBackBufferHeight = 720;
|
||||
this.GraphicsDeviceManager.ApplyChanges();
|
||||
base.LoadContent();
|
||||
this.InputHandler.HandleKeyboardRepeats = false;
|
||||
|
||||
this.camera = new Camera(this.GraphicsDevice) {
|
||||
AutoScaleWithScreen = true,
|
||||
Scale = 4,
|
||||
Position = new Vector2(0, float.MaxValue)
|
||||
};
|
||||
this.Map = new Map("Level1");
|
||||
this.Player = new Player(this.Map, new Vector2(5, 20));
|
||||
this.Map.AddEntity(this.Player);
|
||||
}
|
||||
|
||||
protected override void DoUpdate(GameTime gameTime) {
|
||||
base.DoUpdate(gameTime);
|
||||
|
||||
this.Map.Update(gameTime);
|
||||
this.camera.ConstrainWorldBounds(Vector2.Zero, this.Map.SizeInPixels.ToVector2());
|
||||
}
|
||||
|
||||
protected override void DoDraw(GameTime gameTime) {
|
||||
this.GraphicsDevice.Clear(Color.CornflowerBlue);
|
||||
base.DoDraw(gameTime);
|
||||
this.Map.Draw(gameTime, this.SpriteBatch, this.camera);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
37
GreatSpringGameJam/GreatSpringGameJam.csproj
Normal file
37
GreatSpringGameJam/GreatSpringGameJam.csproj
Normal file
|
@ -0,0 +1,37 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
<TieredCompilation>false</TieredCompilation>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Contentless" Version="3.0.5" />
|
||||
<PackageReference Include="MLEM" Version="5.0.0-64" />
|
||||
<PackageReference Include="MLEM.Extended" Version="5.0.0-64" />
|
||||
<PackageReference Include="MLEM.Startup" Version="5.0.0-64" />
|
||||
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" />
|
||||
<PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.8.0" />
|
||||
<PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0" />
|
||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MonoGameContentReference Include="Content\Content.mgcb" />
|
||||
<Content Include="Content\*\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TrimmerRootAssembly Include="MonoGame.Framework" Visible="false" />
|
||||
<TrimmerRootAssembly Include="MLEM" Visible="false" />
|
||||
<TrimmerRootAssembly Include="MLEM.Ui" Visible="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Content\Palettes" />
|
||||
<Folder Include="Content\Textures" />
|
||||
<Folder Include="Content\Tilesets" />
|
||||
</ItemGroup>
|
||||
</Project>
|
47
GreatSpringGameJam/Map.cs
Normal file
47
GreatSpringGameJam/Map.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using MLEM.Cameras;
|
||||
using MLEM.Extended.Extensions;
|
||||
using MLEM.Extended.Tiled;
|
||||
using MLEM.Misc;
|
||||
using MLEM.Startup;
|
||||
using MonoGame.Extended.Tiled;
|
||||
|
||||
namespace GreatSpringGameJam {
|
||||
public class Map {
|
||||
|
||||
public Point SizeInPixels => new(this.map.WidthInPixels, this.map.HeightInPixels);
|
||||
public Vector2 TileSize => this.map.GetTileSize();
|
||||
public readonly TiledMapCollisions Collisions;
|
||||
|
||||
private readonly TiledMap map;
|
||||
private readonly IndividualTiledMapRenderer renderer;
|
||||
private readonly List<Entity> entities = new();
|
||||
|
||||
public Map(string name) {
|
||||
this.map = MlemGame.LoadContent<TiledMap>($"Maps/{name}");
|
||||
this.renderer = new IndividualTiledMapRenderer(this.map);
|
||||
this.Collisions = new TiledMapCollisions(this.map);
|
||||
}
|
||||
|
||||
public void AddEntity(Entity entity) {
|
||||
this.entities.Add(entity);
|
||||
}
|
||||
|
||||
public void Update(GameTime time) {
|
||||
this.renderer.UpdateAnimations(time);
|
||||
foreach (var entity in this.entities)
|
||||
entity.Update(time);
|
||||
}
|
||||
|
||||
public void Draw(GameTime time, SpriteBatch batch, Camera camera) {
|
||||
batch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, transformMatrix: camera.ViewMatrix);
|
||||
this.renderer.Draw(batch, camera.GetVisibleRectangle().ToExtended());
|
||||
foreach (var entity in this.entities)
|
||||
entity.Draw(time, batch);
|
||||
batch.End();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
84
GreatSpringGameJam/Player.cs
Normal file
84
GreatSpringGameJam/Player.cs
Normal file
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using MLEM.Animations;
|
||||
using MLEM.Extended.Extensions;
|
||||
using MLEM.Extended.Tiled;
|
||||
using MLEM.Extensions;
|
||||
using MLEM.Startup;
|
||||
using MLEM.Textures;
|
||||
using MonoGame.Extended;
|
||||
using MonoGame.Extended.Tiled;
|
||||
using RectangleF = MLEM.Misc.RectangleF;
|
||||
|
||||
namespace GreatSpringGameJam {
|
||||
public class Player : Entity {
|
||||
|
||||
private static readonly UniformTextureAtlas Atlas = new(MlemGame.LoadContent<Texture2D>("Textures/Player"), 4, 1);
|
||||
private readonly SpriteAnimationGroup animations;
|
||||
|
||||
public RectangleF Bounds => new(this.Position + new Vector2(4 / 16F, 0), new Vector2(9 / 16F, 1));
|
||||
|
||||
private bool walking;
|
||||
private bool onGround;
|
||||
private Vector2 velocity;
|
||||
private TimeSpan jumpTime;
|
||||
private bool facingRight;
|
||||
|
||||
public Player(Map map, Vector2 position) : base(map, position) {
|
||||
this.animations = new SpriteAnimationGroup();
|
||||
this.animations.Add(new SpriteAnimation(0.15F, Atlas[1], Atlas[2], Atlas[3], Atlas[0]), () => this.walking);
|
||||
this.animations.Add(new SpriteAnimation(1, Atlas[0]), () => !this.walking);
|
||||
}
|
||||
|
||||
public override void Update(GameTime time) {
|
||||
base.Update(time);
|
||||
|
||||
// input
|
||||
var lastVel = this.velocity;
|
||||
if (MlemGame.Input.IsAnyDown(Keys.A, Keys.Left, Buttons.DPadLeft, Buttons.LeftThumbstickLeft)) {
|
||||
this.velocity.X -= 0.04F;
|
||||
this.facingRight = false;
|
||||
}
|
||||
if (MlemGame.Input.IsAnyDown(Keys.D, Keys.Right, Buttons.DPadRight, Buttons.LeftThumbstickRight)) {
|
||||
this.velocity.X += 0.04F;
|
||||
this.facingRight = true;
|
||||
}
|
||||
this.walking = this.velocity != lastVel;
|
||||
if (MlemGame.Input.IsAnyDown(Keys.Up, Buttons.B, Keys.Space)) {
|
||||
// only start jumping if we just started pressing the buttons
|
||||
if (this.onGround && MlemGame.Input.IsAnyPressed(Keys.Up, Buttons.B, Keys.Space))
|
||||
this.jumpTime = TimeSpan.FromSeconds(0.3F);
|
||||
this.jumpTime -= time.ElapsedGameTime;
|
||||
if (this.jumpTime > TimeSpan.Zero)
|
||||
this.velocity.Y = -0.15F;
|
||||
} else {
|
||||
this.jumpTime = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
// movement and collisions
|
||||
this.onGround = false;
|
||||
this.Position += this.velocity;
|
||||
foreach (var (normal, penetration) in this.Map.Collisions.GetPenetrations(() => this.Bounds.ToExtended())) {
|
||||
this.Position -= normal * penetration;
|
||||
this.velocity *= new Vector2(Math.Abs(normal.Y), Math.Abs(normal.X));
|
||||
if (normal.Y > 0)
|
||||
this.onGround = true;
|
||||
}
|
||||
this.velocity *= new Vector2(this.onGround ? 0.5F : 0.6F, 0.9F);
|
||||
this.velocity.Y += 0.02F;
|
||||
|
||||
this.animations.Update(time);
|
||||
}
|
||||
|
||||
public override void Draw(GameTime time, SpriteBatch batch) {
|
||||
base.Draw(time, batch);
|
||||
var effects = this.facingRight ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
batch.Draw(this.animations.CurrentRegion, this.Position * this.Map.TileSize, Color.White, 0, Vector2.Zero, 1, effects, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
14
GreatSpringGameJam/Program.cs
Normal file
14
GreatSpringGameJam/Program.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using MLEM.Misc;
|
||||
|
||||
namespace GreatSpringGameJam {
|
||||
public static class Program {
|
||||
|
||||
public static void Main() {
|
||||
TextInputWrapper.Current = new TextInputWrapper.DesktopGl<TextInputEventArgs>((w, c) => w.TextInput += c);
|
||||
using var game = new GameImpl();
|
||||
game.Run();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
5
NuGet.config
Normal file
5
NuGet.config
Normal file
|
@ -0,0 +1,5 @@
|
|||
<configuration>
|
||||
<config>
|
||||
<add key="globalPackagesFolder" value="./packages" />
|
||||
</config>
|
||||
</configuration>
|
Loading…
Reference in a new issue