From ca7ff37d48648f26300cfa34658dbc9914ad8aca Mon Sep 17 00:00:00 2001 From: j2-isaac <jai2.isaac@live.uwe.ac.uk> Date: Fri, 21 Jul 2023 21:28:12 +0000 Subject: [PATCH] Upload New File --- bullet.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bullet.cpp diff --git a/bullet.cpp b/bullet.cpp new file mode 100644 index 0000000..ed2fb6b --- /dev/null +++ b/bullet.cpp @@ -0,0 +1,18 @@ +#include "bullet.h" + +Bullet::Bullet(float startX, float startY) { + // Set up the bullet's shape and initial position + m_shape.setSize(sf::Vector2f(5, 20)); + m_shape.setFillColor(sf::Color::White); + m_shape.setPosition(startX, startY); +} + +void Bullet::update() { + // Update bullet logic + m_shape.move(0, -5); // Move the bullet upward (change the '5' to control bullet speed) +} + +void Bullet::draw(sf::RenderTarget& target, sf::RenderStates states) const { + // Draw the bullet to the render target (usually a window) + target.draw(m_shape, states); +} \ No newline at end of file -- GitLab