Skip to content

Commit

Permalink
feat: add kickback to blunderbass. (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Dec 15, 2023
1 parent 496b493 commit 58cf781
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packs/devpack/items/blunderbass/BlunderbassMeta.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ kind: !Struct
schema: f32
- name: bullet
schema: UntypedHandle # Handle<BulletMeta>
- name: kickback
schema: f32

2 changes: 2 additions & 0 deletions packs/devpack/items/blunderbass/blunderbass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ cooldown: 0.75
bullet_count: 4
bullet_spread: 0.8
bullet: ./bullet.yaml
kickback: 10

7 changes: 7 additions & 0 deletions packs/devpack/items/blunderbass/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ local function update()
local player_ent = used.owner
local player_sprite = components:get(player_ent, AtlasSprite)
local player_transform = components:get(player_ent, Transform)
local player_body = components:get(player_ent, KinematicBody)

if player_sprite.flip_x then
player_body.velocity.x = player_body.velocity.x + blunderbass_meta.kickback
else
player_body.velocity.x = player_body.velocity.x - blunderbass_meta.kickback
end

-- Spawn bullets
for i = 1, blunderbass_meta.bullet_count do
Expand Down

0 comments on commit 58cf781

Please sign in to comment.