mirror of
https://github.com/NoelFB/tiny_link.git
synced 2024-11-28 19:08:55 +08:00
updated to latest 'blah' version
This commit is contained in:
parent
26bc63236d
commit
4740c54465
|
@ -1 +1 @@
|
||||||
Subproject commit a72cd5cab60f297926e18fa6d3d1fc125551bb9d
|
Subproject commit 3f07c03fa51162cee4dbe53abf4a958bb6c35cda
|
|
@ -181,10 +181,10 @@ bool TL::Collider::rect_to_grid(const Collider* a, const Collider* b, Point offs
|
||||||
RectI rect = a->m_rect + a->entity()->position + offset - b->entity()->position;
|
RectI rect = a->m_rect + a->entity()->position + offset - b->entity()->position;
|
||||||
|
|
||||||
// get the cells the rectangle overlaps
|
// get the cells the rectangle overlaps
|
||||||
int left = Calc::clamp_int(Calc::floor(rect.x / (float)b->m_grid.tile_size), 0, b->m_grid.columns);
|
int left = Calc::clamp((int)Calc::floor(rect.x / (float)b->m_grid.tile_size), 0, b->m_grid.columns);
|
||||||
int right = Calc::clamp_int(Calc::ceiling(rect.right() / (float)b->m_grid.tile_size), 0, b->m_grid.columns);
|
int right = Calc::clamp((int)Calc::ceiling(rect.right() / (float)b->m_grid.tile_size), 0, b->m_grid.columns);
|
||||||
int top = Calc::clamp_int(Calc::floor(rect.y / (float)b->m_grid.tile_size), 0, b->m_grid.rows);
|
int top = Calc::clamp((int)Calc::floor(rect.y / (float)b->m_grid.tile_size), 0, b->m_grid.rows);
|
||||||
int bottom = Calc::clamp_int(Calc::ceiling(rect.bottom() / (float)b->m_grid.tile_size), 0, b->m_grid.rows);
|
int bottom = Calc::clamp((int)Calc::ceiling(rect.bottom() / (float)b->m_grid.tile_size), 0, b->m_grid.rows);
|
||||||
|
|
||||||
// check each cell
|
// check each cell
|
||||||
for (int x = left; x < right; x++)
|
for (int x = left; x < right; x++)
|
||||||
|
|
|
@ -24,20 +24,15 @@ namespace
|
||||||
|
|
||||||
Player::Player()
|
Player::Player()
|
||||||
{
|
{
|
||||||
input_move = VirtualStick()
|
input_move.add_dpad(0);
|
||||||
.add_keys(Key::Left, Key::Right, Key::Up, Key::Down)
|
input_move.add_left_stick(0, 0.2f);
|
||||||
.add_buttons(0, Button::Left, Button::Right, Button::Up, Button::Down)
|
input_move.add(Key::Left, Key::Right, Key::Up, Key::Down);
|
||||||
.add_axes(0, Axis::LeftX, Axis::LeftY, 0.2f);
|
|
||||||
|
|
||||||
input_jump = VirtualButton()
|
input_jump.press_buffer = 0.15f;
|
||||||
.press_buffer(0.15f)
|
input_jump.add(Key::X, Button::A);
|
||||||
.add_key(Key::X)
|
|
||||||
.add_button(0, Button::A);
|
|
||||||
|
|
||||||
input_attack = VirtualButton()
|
input_attack.press_buffer = 0.15f;
|
||||||
.press_buffer(0.15f)
|
input_attack.add(Key::C, Button::X);
|
||||||
.add_key(Key::C)
|
|
||||||
.add_button(0, Button::X);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::update()
|
void Player::update()
|
||||||
|
@ -51,7 +46,7 @@ void Player::update()
|
||||||
auto hitbox = get<Collider>();
|
auto hitbox = get<Collider>();
|
||||||
auto was_on_ground = m_on_ground;
|
auto was_on_ground = m_on_ground;
|
||||||
m_on_ground = mover->on_ground();
|
m_on_ground = mover->on_ground();
|
||||||
int input = input_move.value_i().x;
|
int input = input_move.sign().x;
|
||||||
|
|
||||||
// Sprite Stuff
|
// Sprite Stuff
|
||||||
{
|
{
|
||||||
|
@ -121,7 +116,7 @@ void Player::update()
|
||||||
{
|
{
|
||||||
if (input_jump.pressed() && mover->on_ground())
|
if (input_jump.pressed() && mover->on_ground())
|
||||||
{
|
{
|
||||||
input_jump.clear_press_buffer();
|
input_jump.consume_press();
|
||||||
anim->scale = Vec2(m_facing * 0.65f, 1.4f);
|
anim->scale = Vec2(m_facing * 0.65f, 1.4f);
|
||||||
mover->speed.x = input * max_air_speed;
|
mover->speed.x = input * max_air_speed;
|
||||||
m_jump_timer = jump_time;
|
m_jump_timer = jump_time;
|
||||||
|
@ -131,7 +126,7 @@ void Player::update()
|
||||||
// Begin Attack
|
// Begin Attack
|
||||||
if (input_attack.pressed())
|
if (input_attack.pressed())
|
||||||
{
|
{
|
||||||
input_attack.clear_press_buffer();
|
input_attack.consume_press();
|
||||||
|
|
||||||
m_state = st_attack;
|
m_state = st_attack;
|
||||||
m_attack_timer = 0;
|
m_attack_timer = 0;
|
||||||
|
|
|
@ -18,9 +18,9 @@ namespace TL
|
||||||
|
|
||||||
int health = max_health;
|
int health = max_health;
|
||||||
|
|
||||||
VirtualStick input_move;
|
StickBinding input_move;
|
||||||
VirtualButton input_jump;
|
Binding input_jump;
|
||||||
VirtualButton input_attack;
|
Binding input_attack;
|
||||||
|
|
||||||
Player();
|
Player();
|
||||||
void update() override;
|
void update() override;
|
||||||
|
|
|
@ -45,7 +45,7 @@ FilePath Content::path()
|
||||||
if (!Directory::exists(root))
|
if (!Directory::exists(root))
|
||||||
BLAH_ERROR("Unable to find content directory!");
|
BLAH_ERROR("Unable to find content directory!");
|
||||||
|
|
||||||
Log::print("Content Path: %s", root.cstr());
|
Log::info("Content Path: %s", root.cstr());
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
|
|
|
@ -241,8 +241,8 @@ void Game::update()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player->entity()->position = Point(
|
player->entity()->position = Point(
|
||||||
Calc::clamp_int(pos.x, bounds.x, bounds.x + bounds.w),
|
Calc::clamp(pos.x, bounds.x, bounds.x + bounds.w),
|
||||||
Calc::clamp_int(pos.y, bounds.y, bounds.y + bounds.h + 100));
|
Calc::clamp(pos.y, bounds.y, bounds.y + bounds.h + 100));
|
||||||
|
|
||||||
// reload if they fell out the bottom
|
// reload if they fell out the bottom
|
||||||
if (player->entity()->position.y > bounds.y + bounds.h + 64)
|
if (player->entity()->position.y > bounds.y + bounds.h + 64)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user