This repository has been archived on 2022-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
space-war/src/game/action.cpp

15 lines
375 B
C++
Raw Normal View History

#include "game/action.hpp"
void Shoot(SpaceshipWeaponCmpt& weapon, const Point& dir) {
if (weapon.IsCoolDowning()) return;
Point playerCenterPos = weapon.owner->Get<MoveCmpt>()->position;
auto bullet = weapon.ShootBullet(Normalize(dir) * weapon.shootSpeed);
Bullets.Add(bullet);
weapon.coolDown = weapon.shootDuration;
Sounds["shoot"]->Play();
}