summaryrefslogtreecommitdiff
path: root/data/enemyData.lua
blob: 6cfea9634a70d2929b1866ba8b7b1fdac061ec40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
require "data.directions"
local audio = require "utils.audio"

local enemyData = {
    lancer = {
        size = 20,
        zoom = 1/16,
        speed = 35,
        health = 100,
        sprite = {
            type = "spritesheet",
            name = "lancer",
            sheet = { row = 2, col = 8, width = 32, height = 32 },
            totalFrames = 2,
            frames = {
                [Direction.LEFT] = { 5, 6 },
                [Direction.RIGHT] = { 3, 4 },
                [Direction.DOWN] = { 1, 2 },
                [Direction.UP] = { 7, 8 }
            },
        },
        drops = {
            { type = "blueheart", amount = 1, chances = 1 },
            { type = "blueheart", amount = 1, chances = 0.25 }
        },
    },
    spiger = {
        size = 30,
        zoom = 1/16,
        speed = 20,
        health = 150,
        sprite = {
            type = "spritesheet",
            name = "spiger",
            sheet = { row = 4, col = 6, width = 32, height = 32 },
            totalFrames = 6,
            frames = {
                [Direction.LEFT] = { 19, 20, 21, 22, 23, 24 },
                [Direction.RIGHT] = { 13, 14, 15, 16, 17, 18 },
                [Direction.DOWN] = { 1, 2, 3, 4, 5, 6 },
                [Direction.UP] = { 7, 8, 9, 10, 11, 12 }
            },
        },
        drops = {
            { type = "purpleheart", amount = 1, chances = 1 },
            { type = "stickyheart", amount = 1, chances = 0.5 }
        },
    },
    librarian = {
        size = 30,
        zoom = 1/16,
        speed = 90,
        health = 100,
        sprite = {
            type = "spritesheet",
            name = "librarian",
            sheet = { row = 1, col = 6 },
            totalFrames = 3,
            frames = {
                [Direction.LEFT] = { 4, 5, 6 },
                [Direction.RIGHT] = { 1, 2, 3 },
                [Direction.DOWN] = { 1, 2, 3 },
                [Direction.UP] = { 4, 5, 6 }
            },
        },
        drops = {
            { type = "greenheart", amount = 1, chances = 1 },
            { type = "greenheart", amount = 1, chances = 0.25 }
        },
        movePattern = "vertical",
    },
    citrusLitulon = {
        size = 16,
        zoom = 1/16,
        speed = 60,
        health = 50,
        sprite = {
            type = "spritesheet",
            name = "citrus-litulon",
            sheet = { row = 4, col = 4 },
            totalFrames = 4,
            frames = {
                [Direction.RIGHT] = { 1, 2, 3, 4 },
                [Direction.DOWN] = { 5, 6, 7, 8 },
                [Direction.LEFT] = { 9, 10, 11, 12 },
                [Direction.UP] = { 13, 14, 15, 16 }
            },
        },
        drops = {
            { type = "yellowheart", amount = 2, chances = 1 },
            { type = "shinyheart", amount = 1, chances = 0.2 }
        },
    },
    pokob = {
        size = 30,
        zoom = 1/16,
        speed = 30,
        health = 250,
        sprite = {
            type = "spritesheet",
            name = "pokob",
            sheet = { row = 4, col = 12 },
            totalFrames = 4,
            frames = {
                [Direction.LEFT] = { 4, 5, 4, 6 },
                [Direction.RIGHT] = { 1, 2, 1, 3 },
                [Direction.DOWN] = { 7, 8, 7, 9 },
                [Direction.UP] = { 10, 11, 10, 12 }
            },
        },
        drops = {
            { type = "bigheart", amount = 1, chances = 0.5 },
            { type = "brokenheart", amount = 1, chances = 1 },
            { type = "brokenheart", amount = 1, chances = 0.5 }
        },
        onHit = function(shot)
            -- drop a broken heart when hit pokob
            -- there's a small chance to drop heart if the heart itself is broken
            if shot.type == "brokenheart" then
                local temp = math.random(10)
                if temp > 3 then return end
            end

            local Loot = require "objects.loot"
            local lootItem = Loot:new("brokenheart", shot.x, shot.y)
            table.insert(G.currentRoom.objects.loots, lootItem)

            audio.play("hitGlass")
        end
    }
}

return enemyData