added some nice clouds

This commit is contained in:
Ell 2021-03-14 15:02:31 +01:00
parent e6266dec54
commit 26ea68b1cd
5 changed files with 8 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -38,7 +38,7 @@ namespace GreatSpringGameJam {
if (normal.Y > 0) {
onGround = true;
var (_, below) = this.GetTileBelow();
if (below != null && below.Properties.GetBool("JumpPad") && velocity.Y > 0) {
if (below != null && below.Properties.GetBool("JumpPad") && velocity.Y > 0.1F) {
velocity.Y = -velocity.Y;
continue;
}

View File

@ -82,7 +82,7 @@ namespace GreatSpringGameJam {
buttons.AddChild(new Button(Anchor.AutoCenter, new Vector2(1, 60), "<i Gnome> Play <i Flower>") {
OnPressed = e => {
if (!this.IsInCutscene)
this.StartLevel("Level4", Color.White);
this.StartLevel("Overworld", Color.White);
}
});
buttons.AddChild(new VerticalSpace(10));

View File

@ -114,10 +114,14 @@ namespace GreatSpringGameJam {
var parallax = camera.Position * parallaxFactor;
var (parW, parH) = this.SizeInPixels.ToVector2() * (1 - parallaxFactor) + camera.ScaledViewport * parallaxFactor;
var mountains = BackgroundTexture[0, 0, 8, 4];
for (var x = 0; x < parW; x += mountains.Width * 2) {
for (var x = 0; x < parW; x += mountains.Width * 2)
batch.Draw(mountains, parallax + new Vector2(x, parH - mountains.Height * 2), Color.White * 0.5F, 0, Vector2.Zero, 2, SpriteEffects.None, 0);
var clouds = BackgroundTexture[0, 4, 8, 2];
for (var x = -1; x < parW / clouds.Width / 2; x++) {
var pos = new Vector2(x * clouds.Width * 2, parH - mountains.Height * 2 - clouds.Height * 4);
batch.Draw(clouds, parallax + pos + new Vector2((float) time.TotalGameTime.TotalSeconds * 3 % (clouds.Width * 2), 0), Color.White * 0.5F, 0, Vector2.Zero, 2, SpriteEffects.None, 0);
batch.Draw(clouds, parallax + pos + new Vector2(clouds.Width + (float) time.TotalGameTime.TotalSeconds * 2.5F % (clouds.Width * 2), clouds.Height * 1.5F), Color.White * 0.5F, 0, Vector2.Zero, 2, SpriteEffects.None, 0);
}
// render map etc.
this.DrawLayer(batch, "Background", camera);
this.DrawLayer(batch, "Ground", camera);