Compare commits
3 Commits
61d024b56d
...
c7930db414
Author | SHA1 | Date | |
---|---|---|---|
c7930db414 | |||
438b0a35bb | |||
9c5252fe3b |
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.9 KiB |
@ -1,21 +1,21 @@
|
|||||||
x x
|
x x
|
||||||
x x
|
x x
|
||||||
x x
|
x x
|
||||||
x S S x
|
x S S x
|
||||||
x xxxxxx x
|
x xxxxxx S S x
|
||||||
x x
|
x xxxxxxxxxxx x
|
||||||
x x
|
x x
|
||||||
x x
|
x xxxxx x
|
||||||
x xxxxxx x
|
x xxxxxx x x
|
||||||
x x
|
x x xxxxxxxxx x
|
||||||
x x
|
x S S x x x
|
||||||
x xxxxxx x
|
x xxxxxx xxxxxx xxxxx xxxxx xxxxxxx xxxxx x
|
||||||
x x
|
x x x x
|
||||||
x x
|
x x x xxx x
|
||||||
x x
|
x x S x x x x
|
||||||
xxxxxxxxxx x
|
xxxxxxxxxx xxxxx xxxxx x xxxx xxx x x
|
||||||
x x
|
x x x x x
|
||||||
x S S S x
|
x S S S x xxx x x
|
||||||
x P S S S S x
|
x P S S S S S x x x x
|
||||||
xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
|
@ -47,8 +47,8 @@ pub const Context = struct {
|
|||||||
const events = try allegro.createEventQueue();
|
const events = try allegro.createEventQueue();
|
||||||
|
|
||||||
allegro.setNewDisplayOption(allegro.NewDisplayOption.VSYNC, 1, allegro.OptionImportance.SUGGEST);
|
allegro.setNewDisplayOption(allegro.NewDisplayOption.VSYNC, 1, allegro.OptionImportance.SUGGEST);
|
||||||
allegro.setNewDisplayOption(allegro.NewDisplayOption.SAMPLE_BUFFERS, 1, allegro.OptionImportance.REQUIRE);
|
// allegro.setNewDisplayOption(allegro.NewDisplayOption.SAMPLE_BUFFERS, 1, allegro.OptionImportance.REQUIRE);
|
||||||
allegro.setNewDisplayOption(allegro.NewDisplayOption.SAMPLES, 4, allegro.OptionImportance.REQUIRE);
|
// allegro.setNewDisplayOption(allegro.NewDisplayOption.SAMPLES, 4, allegro.OptionImportance.REQUIRE);
|
||||||
allegro.setNewDisplayFlags(allegro.NewDisplayFlags{ .RESIZABLE = true });
|
allegro.setNewDisplayFlags(allegro.NewDisplayFlags{ .RESIZABLE = true });
|
||||||
const display = try allegro.createDisplay(DefaultDisplayWidth, DefaultDisplayHeight);
|
const display = try allegro.createDisplay(DefaultDisplayWidth, DefaultDisplayHeight);
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ pub const Game = struct {
|
|||||||
self.playerVelocity.y = 0;
|
self.playerVelocity.y = 0;
|
||||||
} else if (self.playerVelocity.y < 0 and self.playerIsUnderTile()) {
|
} else if (self.playerVelocity.y < 0 and self.playerIsUnderTile()) {
|
||||||
self.playerPosition.y = std.math.ceil(self.playerPosition.y);
|
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) {
|
if (self.playerVelocity.x != 0) {
|
||||||
const playerTileTop = @floatToInt(i64, std.math.floor(self.playerPosition.y));
|
const playerTileTop = @floatToInt(i64, std.math.floor(self.playerPosition.y));
|
||||||
@ -101,7 +101,13 @@ pub const Game = struct {
|
|||||||
self.playerVelocity.x = 0;
|
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;
|
self.playerDirection = if (self.playerVelocity.x == 0) self.playerDirection else if (self.playerVelocity.x > 0) Direction.Right else Direction.Left;
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ pub const GameScene = struct {
|
|||||||
3 => {
|
3 => {
|
||||||
if (!ordinals.left) offset = 6;
|
if (!ordinals.left) offset = 6;
|
||||||
if (!ordinals.right) offset = 7;
|
if (!ordinals.right) offset = 7;
|
||||||
|
if (!ordinals.bottom) offset = 10 + self.game.randomTileOffset(x, y, 2);
|
||||||
},
|
},
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user