From c553dfafa386cbcb08ade25a235a5b00082d4c5b Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 22 Jun 2019 20:17:36 +0200 Subject: [PATCH] feat(examples): add ducking in plateforming example Show how we can now modify in action an hitbox without glitching it --- CHANGELOG.md | 4 ++++ examples/gameplay/plateform/actors/player.lua | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebec843..d268b70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- **actor2D:** Make hitbox modifiable. + ### Changed - **world2D:** Use a list for bodies (hitboxes, etc) and one other for actors diff --git a/examples/gameplay/plateform/actors/player.lua b/examples/gameplay/plateform/actors/player.lua index b2c5322..cc892f6 100644 --- a/examples/gameplay/plateform/actors/player.lua +++ b/examples/gameplay/plateform/actors/player.lua @@ -15,7 +15,9 @@ function Player:updateStart(dt) self.ysp = -280 end if self.keys["down"].isDown then - --self.ysp = 120 + self.mainHitbox:modify(0, 8, 16, 16) + else + self.mainHitbox:modify(0, 0, 16, 24) end if self.keys["left"].isDown then self.xsp = -120