mirror of
https://github.com/NoelFB/tiny_link.git
synced 2024-11-25 18:18:56 +08:00
Merge branch 'main' into main
This commit is contained in:
commit
cc5f137fa6
3
content/map/readme.md
Normal file
3
content/map/readme.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Due to making this game under heavy time constraints, I opted not to make or use a level editor. Instead, each object is assigned a color and I used a generic paint tool to design the levels.
|
||||||
|
|
||||||
|
Under normal circumstances, I would argue against this method and instead use something like Ogmo Editor or Tiled. It's really hard to remember what object is what color!
|
5
content/sprites/readme.md
Normal file
5
content/sprites/readme.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
The sprites are stored in the [Aseprite](https://www.aseprite.org/) format, and you'll need Aseprite to edit them.
|
||||||
|
|
||||||
|
A few other notes:
|
||||||
|
- Animations are loaded automatically using Aseprite's `Tag` feature. Each tag is a unique animation
|
||||||
|
- Sprite Origin points use Aseprite's hidden `Slice` feature, which can be used with Shift+C. You can draw slices and give them a pivot point, which we're using to set the origin point of the sprite.
|
1
content/tilesets/readme.md
Normal file
1
content/tilesets/readme.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
The tilesets are stored in the [Aseprite](https://www.aseprite.org/) format, and you'll need Aseprite to edit them.
|
|
@ -1 +1 @@
|
||||||
Subproject commit 63466dc2ea6c2affbdd84a696f592796b98d0b3d
|
Subproject commit a1267c738c1d046b3f7872508b511c820af37fae
|
|
@ -23,8 +23,7 @@ Collider Collider::make_grid(int tile_size, int columns, int rows)
|
||||||
collider.m_grid.tile_size = tile_size;
|
collider.m_grid.tile_size = tile_size;
|
||||||
collider.m_grid.columns = columns;
|
collider.m_grid.columns = columns;
|
||||||
collider.m_grid.rows = rows;
|
collider.m_grid.rows = rows;
|
||||||
collider.m_grid.cells.resize(columns * rows);
|
collider.m_grid.cells.expand(columns * rows);
|
||||||
|
|
||||||
return collider;
|
return collider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <blah.h>
|
#include <blah.h>
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
#include "../world.h"
|
#include "../world.h"
|
||||||
|
|
||||||
using namespace Blah;
|
using namespace Blah;
|
||||||
|
@ -45,7 +43,7 @@ namespace TL
|
||||||
int columns;
|
int columns;
|
||||||
int rows;
|
int rows;
|
||||||
int tile_size;
|
int tile_size;
|
||||||
std::vector<bool> cells;
|
Vector<bool> cells;
|
||||||
};
|
};
|
||||||
|
|
||||||
Shape m_shape = Shape::None;
|
Shape m_shape = Shape::None;
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
|
|
||||||
namespace TL
|
namespace TL
|
||||||
{
|
{
|
||||||
class Enemy : public Component
|
// I just needed a way to track whether any enemies were still
|
||||||
{
|
// in the scene or not, so Locked Doors could open. The easiest
|
||||||
|
// way was to add an Enemy component, and check if there are any
|
||||||
};
|
// in the scene.
|
||||||
|
class Enemy : public Component { };
|
||||||
}
|
}
|
|
@ -21,9 +21,18 @@ namespace TL
|
||||||
static constexpr int st_reflect = 5;
|
static constexpr int st_reflect = 5;
|
||||||
static constexpr int st_dead_state = 6;
|
static constexpr int st_dead_state = 6;
|
||||||
|
|
||||||
|
// health during our first phase
|
||||||
static constexpr int max_health_1 = 10;
|
static constexpr int max_health_1 = 10;
|
||||||
|
|
||||||
|
// health during our second phase
|
||||||
static constexpr int max_health_2 = 3;
|
static constexpr int max_health_2 = 3;
|
||||||
|
|
||||||
|
// current health value (assigned to phase 1 health to start)
|
||||||
int health = max_health_1;
|
int health = max_health_1;
|
||||||
|
|
||||||
|
// phase 0 or 1
|
||||||
|
// 0 = running along the ground and slicing
|
||||||
|
// 1 = flying around in the air shooting orbs
|
||||||
int phase = 0;
|
int phase = 0;
|
||||||
|
|
||||||
GhostFrog();
|
GhostFrog();
|
||||||
|
|
|
@ -8,6 +8,9 @@ using namespace Blah;
|
||||||
|
|
||||||
namespace TL
|
namespace TL
|
||||||
{
|
{
|
||||||
|
// Automatically checks if the provided collider ever overlaps
|
||||||
|
// with something in the `hurt_by` mask. Makes it easy for enemies
|
||||||
|
// to check if they were hit by `Mask::player_attack`
|
||||||
class Hurtable : public Component
|
class Hurtable : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -244,6 +244,10 @@ void Player::update()
|
||||||
|
|
||||||
// hack:
|
// hack:
|
||||||
// destroy orb
|
// destroy orb
|
||||||
|
// ideally we would have an "attack" component that the orb could
|
||||||
|
// subscribe to, and delete itself when it hits the player. since
|
||||||
|
// the orb currently has no way to know if it hit the player, we
|
||||||
|
// have to add this ugly hack!
|
||||||
if (hit->get<Orb>())
|
if (hit->get<Orb>())
|
||||||
hit->entity()->destroy();
|
hit->entity()->destroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ Tilemap::Tilemap(int tile_width, int tile_height, int columns, int rows)
|
||||||
m_tile_height = tile_height;
|
m_tile_height = tile_height;
|
||||||
m_columns = columns;
|
m_columns = columns;
|
||||||
m_rows = rows;
|
m_rows = rows;
|
||||||
m_grid.resize(columns * rows);
|
m_grid.expand(columns * rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tilemap::tile_width() const
|
int Tilemap::tile_width() const
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../world.h"
|
#include "../world.h"
|
||||||
#include <blah.h>
|
#include <blah.h>
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace Blah;
|
using namespace Blah;
|
||||||
|
|
||||||
|
@ -24,7 +22,7 @@ namespace TL
|
||||||
void render(Batch& batch) override;
|
void render(Batch& batch) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Subtexture> m_grid;
|
Vector<Subtexture> m_grid;
|
||||||
int m_tile_width = 0;
|
int m_tile_width = 0;
|
||||||
int m_tile_height = 0;
|
int m_tile_height = 0;
|
||||||
int m_columns = 0;
|
int m_columns = 0;
|
||||||
|
|
|
@ -6,6 +6,8 @@ using namespace Blah;
|
||||||
|
|
||||||
namespace TL
|
namespace TL
|
||||||
{
|
{
|
||||||
|
// Factory to create game objects
|
||||||
|
|
||||||
namespace Factory
|
namespace Factory
|
||||||
{
|
{
|
||||||
Entity* player(World* world, Point position);
|
Entity* player(World* world, Point position);
|
||||||
|
|
|
@ -5,6 +5,8 @@ namespace TL
|
||||||
{
|
{
|
||||||
struct Mask
|
struct Mask
|
||||||
{
|
{
|
||||||
|
// bitfield masks for collision types
|
||||||
|
|
||||||
static constexpr uint32_t solid = 1 << 0;
|
static constexpr uint32_t solid = 1 << 0;
|
||||||
static constexpr uint32_t jumpthru = 1 << 1;
|
static constexpr uint32_t jumpthru = 1 << 1;
|
||||||
static constexpr uint32_t player_attack = 1 << 2;
|
static constexpr uint32_t player_attack = 1 << 2;
|
||||||
|
|
|
@ -111,6 +111,11 @@ namespace TL
|
||||||
public:
|
public:
|
||||||
static constexpr int max_component_types = 256;
|
static constexpr int max_component_types = 256;
|
||||||
|
|
||||||
|
// NOTE:
|
||||||
|
// I tossed this reference here at the very end of making the game,
|
||||||
|
// just so that the boss could tell the game to shake the screen.
|
||||||
|
// Ideally I think there should be a Camera component that handles
|
||||||
|
// that instead.
|
||||||
Game* game;
|
Game* game;
|
||||||
|
|
||||||
World() = default;
|
World() = default;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user