Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hippy Grab WIP #2534

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/nodes/enemies/hippy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ return {
hp = 6,
speed = 10,
vulnerabilities = {'slash'},
grab = true,
tokens = 3,
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
{ item = 'coin', v = 1, p = 0.9 },
Expand Down
10 changes: 8 additions & 2 deletions src/nodes/enemy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function Enemy.new(node, collider, enemytype)

enemy.burn = false
enemy.knockbackDisabled = enemy.props.knockbackDisabled or false
enemy.grab = enemy.props.grab or false

enemy.fadeIn = enemy.props.fadeIn or false
enemy.fade = {255, 255, 255, 0}
Expand Down Expand Up @@ -432,15 +433,20 @@ function Enemy:collide(node, dt, mtv_x, mtv_y)
player:hurt(self.props.damage)
player.top_bb:move(mtv_x, mtv_y)
player.bottom_bb:move(mtv_x, mtv_y)
player.velocity.y = -450
player.velocity.x = self.player_rebound * ( player.position.x < self.position.x + ( self.props.width / 2 ) + self.bb_offset.x and -1 or 1 )
if self.grab then
player.freeze = true
else
player.velocity.y = -450
player.velocity.x = self.player_rebound * ( player.position.x < self.position.x + ( self.props.width / 2 ) + self.bb_offset.x and -1 or 1 )
end
end
end

function Enemy:collide_end( node )
if node and node.isPlayer and node.current_enemy == self then
node.current_enemy = nil
end
player.freeze = false
end

function Enemy:update( dt, player, map )
Expand Down