Skip to content

Commit

Permalink
Merge pull request #1048 from CalebJohn/mariachi
Browse files Browse the repository at this point in the history
Trombonist
  • Loading branch information
kyleconroy committed Mar 23, 2013
2 parents 99dd697 + cd514a3 commit 70d0a4e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Binary file added src/images/enemies/trombone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions src/nodes/enemies/trombone.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
local Timer = require 'vendor/timer'
local sound = require 'vendor/TEsound'

return {
name = 'trombone',
position_offset = { x = 0, y = 0 },
height = 39,
width = 58,
damage = 1,
hp = 4,
tokens = 4,
velocity = { x = 30, y = 0},
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 },
{ item = 'health', v = 1, p = 1 }
},
animations = {
dying = {
right = {'loop', {'1-4,1'}, 0.25},
left = {'loop', {'1-4,2'}, 0.25}
},
default = {
right = {'loop', {'4,1', '2-1,1'}, 0.25},
left = {'loop', {'1,2', '3-4,2'}, 0.25}
}
},
enter = function( enemy )
enemy.direction = math.random(2) == 1 and 'left' or 'right'
enemy.maxx = enemy.position.x + 48
enemy.minx = enemy.position.x - 48
end,
update = function( dt, enemy, player, level )
if enemy.dead then return end

if enemy.position.x > enemy.maxx then
enemy.direction = 'left'
elseif enemy.position.x < enemy.minx then
enemy.direction = 'right'
end

local direction = enemy.direction == 'left' and 1 or -1

enemy.velocity.x = 50 * direction

end

}

0 comments on commit 70d0a4e

Please sign in to comment.