summaryrefslogtreecommitdiff
path: root/data/bulletData.lua
blob: 3fc13642632c4b06c0d0867403dcd2831379588a (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
local enemyData = require "data.enemyData"
local enemies = require "logic.enemies"
local audio = require "utils.audio"

local bulletData = {
    redheart = {
        damage = 500,
    },
    bigheart = {
        damage = 200,
        afterShot = function ()
        end,
        afterHit = function (x, y, enemyType)
            local w, h = love.graphics.getWidth(), love.graphics.getHeight()
            local r = enemyData[enemyType].size + 20

            local bullets = require "logic.bullets"
            -- split heart and shoot at 8 different angle
            local shoottingDirections = {
                {
                    target = { x = x-2*r, y = y-2*r },
                    firer = {x = x-r, y = y-r},
                },
                {
                    target = { x = x+2*r, y = y+2*r },
                    firer = {x = x+r, y = y+r},
                },
                {
                    target = { x = x+2*r, y = y-2*r },
                    firer = {x = x+r, y = y-r},
                },
                {
                    target = { x = x-2*r, y = y+2*r },
                    firer = {x = x-r, y = y+r},
                },
                {
                    target = { x = x, y = 0 },
                    firer = { x = x, y = y-r },
                },
                {
                    target = { x = x, y = h },
                    firer = { x = x, y = y+r },
                },
                {
                    target = { x = 0, y = y },
                    firer = { x = x-r, y = y },
                },
                {
                    target = { x = w, y = y },
                    firer = { x = x+r, y = y },
                }
            }
            for _, direction in ipairs(shoottingDirections) do
                bullets.fire("brokenheart", direction.target, direction.firer)
            end
        end
    },
    shinyheart = {
        damage = 80,
        afterShot = function ()
            G.player:speedUp(30, 10)
        end,
        afterHit = function (x, y, enemyType)
            local stunned = enemies.getWithinRage(x, y, 100)
            for _, enemy in ipairs(stunned) do
                enemy:stun(1)
            end
        end,
        sound = "shootFlash"
    },
    stickyheart = {
        damage = 80,
        afterShot = function ()
        end,
        afterHit = function (x, y, enemyType)
            local slowed = enemies.getWithinRage(x, y, 100)
            for _, enemy in ipairs(slowed) do
                enemy:getSticky(5)
            end
        end
    },
    greenheart = {
        damage = 100,
        afterShot = function ()
        end,
        afterHit = function (x, y, enemyType)
            local stunned = enemies.getWithinRage(x, y, 100)
            for _, enemy in ipairs(stunned) do
                enemy.movePattern = "vertical"
            end
        end
    },
    purpleheart = {
        damage = 100,
        bouncy = 3,
        afterShot = function ()
        end,
        afterHit = function (x, y, enemyType)
        end
    },
    brokenheart = {
        damage = 50,
        afterShot = function ()
        end,
        afterHit = function (x, y, enemyType)
            local affected = enemies.getWithinRage(x, y, 50)
            for _, enemy in ipairs(affected) do
                enemy:takeDamage(10)
                audio.play("hitGlass")
            end
        end
    }
}

return bulletData