From 58cf7810c296a54ef08201b6237e194d7d115453 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Fri, 15 Dec 2023 22:16:05 +0000 Subject: [PATCH] feat: add kickback to blunderbass. (#876) --- .../devpack/items/blunderbass/BlunderbassMeta.schema.yaml | 2 ++ packs/devpack/items/blunderbass/blunderbass.yaml | 2 ++ packs/devpack/items/blunderbass/plugin.lua | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/packs/devpack/items/blunderbass/BlunderbassMeta.schema.yaml b/packs/devpack/items/blunderbass/BlunderbassMeta.schema.yaml index a23d6899bc..efe907fc37 100644 --- a/packs/devpack/items/blunderbass/BlunderbassMeta.schema.yaml +++ b/packs/devpack/items/blunderbass/BlunderbassMeta.schema.yaml @@ -23,4 +23,6 @@ kind: !Struct schema: f32 - name: bullet schema: UntypedHandle # Handle + - name: kickback + schema: f32 diff --git a/packs/devpack/items/blunderbass/blunderbass.yaml b/packs/devpack/items/blunderbass/blunderbass.yaml index 9fdb67e725..077986c6c9 100644 --- a/packs/devpack/items/blunderbass/blunderbass.yaml +++ b/packs/devpack/items/blunderbass/blunderbass.yaml @@ -8,3 +8,5 @@ cooldown: 0.75 bullet_count: 4 bullet_spread: 0.8 bullet: ./bullet.yaml +kickback: 10 + diff --git a/packs/devpack/items/blunderbass/plugin.lua b/packs/devpack/items/blunderbass/plugin.lua index af5c9e706c..21579c382c 100644 --- a/packs/devpack/items/blunderbass/plugin.lua +++ b/packs/devpack/items/blunderbass/plugin.lua @@ -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