Compare commits
4 commits
abb33b4cbe
...
7f86166f8d
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f86166f8d | |||
| 4e06585f12 | |||
| 829d35c2ca | |||
| 77c9bf03f5 |
2 changed files with 3 additions and 1 deletions
|
|
@ -49,6 +49,7 @@ end
|
|||
---@param x number|nil horizontal position
|
||||
---@param y number|nil vertical position
|
||||
---@param opts table|nil additional arguments
|
||||
---@return GameObject
|
||||
function Area:addGameObject(game_object_type, x, y, opts)
|
||||
local game_object = _G[game_object_type](self, x or 0, y or 0, opts or {})
|
||||
table.insert(self.game_objects, game_object)
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ function Player:shoot()
|
|||
local d = 1.2*self.w
|
||||
local offset_x, offset_y = self.x + d*math.cos(self.r), self.y + d*math.sin(self.r)
|
||||
self.area:addGameObject('ShootEffect', offset_x, offset_y, {player = self, d = d})
|
||||
self.area:addGameObject('Projectile', offset_x, offset_y, {r = self.r})
|
||||
local proj = self.area:addGameObject('Projectile', offset_x, offset_y, {v = 100 ,r = self.r})
|
||||
proj.timer:tween(0.5, proj, {v = 400}, 'linear')
|
||||
end
|
||||
|
||||
return Player
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue