diff options
| author | Eltrac <hi@guhub.cn> | 2025-02-20 16:39:45 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-02-20 16:39:45 +0800 |
| commit | 6fac71363024403c8bc5e92d286153dbe48b389a (patch) | |
| tree | a469c152cdfbb882b323dacd1447c7bcd0bc0124 /objects/Enemy.lua | |
| parent | 13a208ec28b21279a20438800f5b0acac43eaf1b (diff) | |
refactor: use Body object
- Body defines an object's size and shape
- Body provides a universal function to detect collision
Diffstat (limited to 'objects/Enemy.lua')
| -rw-r--r-- | objects/Enemy.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/objects/Enemy.lua b/objects/Enemy.lua index c00ea5f..05990f1 100644 --- a/objects/Enemy.lua +++ b/objects/Enemy.lua @@ -7,7 +7,7 @@ function Enemy:new(name, location) presetLocation = (type(location) == "string" and location) or nil, x = (type(location) == "table" and location.x) or nil, y = (type(location) == "table" and location.y) or nil, - r = enemyData[name] and enemyData[name].size or nil, + body = Body:new("circle", enemyData[name] and enemyData[name].size or nil), speed = enemyData[name] and enemyData[name].speed or nil, } |
