Compare commits

...

3 Commits

5 changed files with 31 additions and 24 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -2,20 +2,20 @@ x
x x
x x
x S S x
x xxxxxx x
x xxxxxx S S x
x xxxxxxxxxxx x
x x
x x
x x
x xxxxxx x
x x
x x
x xxxxxx x
x x
x x
x x
xxxxxxxxxx x
x x
x S S S x
x P S S S S x
xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x xxxxx x
x xxxxxx x x
x x xxxxxxxxx x
x S S x x x
x xxxxxx xxxxxx xxxxx xxxxx xxxxxxx xxxxx x
x x x x
x x x xxx x
x x S x x x x
xxxxxxxxxx xxxxx xxxxx x xxxx xxx x x
x x x x x
x S S S x xxx x x
x P S S S S S x x x x
xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

View File

@ -47,8 +47,8 @@ pub const Context = struct {
const events = try allegro.createEventQueue();
allegro.setNewDisplayOption(allegro.NewDisplayOption.VSYNC, 1, allegro.OptionImportance.SUGGEST);
allegro.setNewDisplayOption(allegro.NewDisplayOption.SAMPLE_BUFFERS, 1, allegro.OptionImportance.REQUIRE);
allegro.setNewDisplayOption(allegro.NewDisplayOption.SAMPLES, 4, allegro.OptionImportance.REQUIRE);
// allegro.setNewDisplayOption(allegro.NewDisplayOption.SAMPLE_BUFFERS, 1, allegro.OptionImportance.REQUIRE);
// allegro.setNewDisplayOption(allegro.NewDisplayOption.SAMPLES, 4, allegro.OptionImportance.REQUIRE);
allegro.setNewDisplayFlags(allegro.NewDisplayFlags{ .RESIZABLE = true });
const display = try allegro.createDisplay(DefaultDisplayWidth, DefaultDisplayHeight);

View File

@ -89,7 +89,7 @@ pub const Game = struct {
self.playerVelocity.y = 0;
} else if (self.playerVelocity.y < 0 and self.playerIsUnderTile()) {
self.playerPosition.y = std.math.ceil(self.playerPosition.y);
self.playerVelocity.y = -self.playerVelocity.y;
self.playerVelocity.y = 0.1;
}
if (self.playerVelocity.x != 0) {
const playerTileTop = @floatToInt(i64, std.math.floor(self.playerPosition.y));
@ -101,7 +101,13 @@ pub const Game = struct {
self.playerVelocity.x = 0;
}
}
// const playerTileRight = @floatToInt(i64, std.math.floor(self.playerPosition.x)) + 1;
if (self.playerVelocity.x > 0) {
const playerTileRight = @floatToInt(i64, std.math.floor(self.playerPosition.x)) + 1;
if (self.level.tiles.get(playerTileRight, playerTileTop) != null or self.level.tiles.get(playerTileRight, playerTileBottom) != null) {
self.playerPosition.x = std.math.floor(self.playerPosition.x);
self.playerVelocity.x = 0;
}
}
}
self.playerDirection = if (self.playerVelocity.x == 0) self.playerDirection else if (self.playerVelocity.x > 0) Direction.Right else Direction.Left;

View File

@ -121,6 +121,7 @@ pub const GameScene = struct {
3 => {
if (!ordinals.left) offset = 6;
if (!ordinals.right) offset = 7;
if (!ordinals.bottom) offset = 10 + self.game.randomTileOffset(x, y, 2);
},
else => {},
}