initial commit
This commit is contained in:
26
src/Bubble.cpp
Normal file
26
src/Bubble.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "Bubble.h"
|
||||
#include "Aquarium.h"
|
||||
#include <ncurses.h>
|
||||
|
||||
Bubble::Bubble(float x, float y) : Entity() {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
}
|
||||
|
||||
void Bubble::update() { y -= 1; }
|
||||
|
||||
void Bubble::draw() {
|
||||
lifetime++;
|
||||
|
||||
// Determine the frame based on lifetime
|
||||
int frameNumber = lifetime / 9;
|
||||
if (frameNumber > 2)
|
||||
frameNumber = 2;
|
||||
|
||||
char frame = bubbleChars[frameNumber];
|
||||
|
||||
std::string line(1, frame);
|
||||
std::string colorLine(1, 'c');
|
||||
|
||||
Aquarium::getInstance().drawToBackBuffer(y, x, 0, line, colorLine);
|
||||
}
|
||||
Reference in New Issue
Block a user