Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed whale drawing issues
  • Loading branch information
LindseyB committed Oct 24, 2010
1 parent 8110ce4 commit 84e5ca5
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 43 deletions.
11 changes: 8 additions & 3 deletions AAR.d
Expand Up @@ -71,12 +71,17 @@ void drawLevelScreen() {
sc = new SoundClip("music/" ~ currentLevel._audio);
sc.start();

int count = 0;
while(levelS._playing){
clear();
levelS.draw();
//Thread.sleep(0.05);
Thread.sleep(levelS._arrowSect.sleep);
if(count%5 == 0){
levelS.draw(false);
} else {
levelS.draw(true);
}
refresh();
Thread.sleep(levelS._arrowSect.sleep/5.0);
count++;
}

sc.stop();
Expand Down
9 changes: 5 additions & 4 deletions animatedAsciiSprite.d
Expand Up @@ -12,14 +12,15 @@ class AnimatedAsciiSprite : AsciiSprite {
bool _loop;
bool _animate;

this(char[] filePath, WINDOW* win, bool transparent = false, bool loop = false, int x=0, int y=0){
this(char[] filePath, WINDOW* win, bool transparent, bool loop, int x=0, int y=0){
_frame = 0;
auto _spriteFile = new TextFileInput(filePath);
super._x = x;
super._y = y;
super._win = win;
super._transparent = transparent;
_animate = true;
_loop = loop;

bool firstLine = true;
char[][] newFrame;
Expand Down Expand Up @@ -49,10 +50,10 @@ class AnimatedAsciiSprite : AsciiSprite {

void nextFrame() {
if(_animate){
int before = _frame++;
int before = ++_frame;
_frame %= _animation.length;

if(before == _animation.length && _frame == 0){
if(!_loop && before == _animation.length && _frame == 0){
_animate = false;
}

Expand Down
66 changes: 33 additions & 33 deletions arrowSection.d
Expand Up @@ -44,47 +44,47 @@ class ArrowSection {
}
}

void draw() {
void draw(bool fast) {
_frame.drawSprite();
// draw arrows and shit

hit.drawSprite();


if(offset == 0){
// parse shite frum file, appendto arrows and drop top if required
Beat* beat = new Beat;

char[] line = chartFile.next;

foreach(ch; line){
switch(ch){
case 'l': beat.arrows |= 1; break;
case 'r': beat.arrows |= 2; break;
case 'u': beat.arrows |= 4; break;
case 'd': beat.arrows |= 8; break;
case 'x': break;
if(!fast){
if(offset == 0){
// parse shite frum file, appendto arrows and drop top if required
Beat* beat = new Beat;

char[] line = chartFile.next;

foreach(ch; line){
switch(ch){
case 'l': beat.arrows |= 1; break;
case 'r': beat.arrows |= 2; break;
case 'u': beat.arrows |= 4; break;
case 'd': beat.arrows |= 8; break;
case 'x': break;
}
}

//beat.arrows = randomArrows();
//beat.period = .1;

beats ~= beat;

if(beats.length > beatsOnScreen){
beats = beats[1..$];
}

/*if(beats[0].period != 0){
sleep = beats[0].period;
}*/
}
}

//beat.arrows = randomArrows();
//beat.period = .1;

beats ~= beat;

if(beats.length > beatsOnScreen){
beats = beats[1..$];
}

/*if(beats[0].period != 0){
sleep = beats[0].period;
}*/
offset--;
if(offset < 0){offset = 4;}
}

offset--;
if(offset < 0){offset = 4;}


// Draw
for(int i = 0; i < beats.length; i++){

Expand Down Expand Up @@ -131,4 +131,4 @@ private:
struct Beat{
ubyte arrows; //lrud
double period;
}
}
1 change: 1 addition & 0 deletions dancingMan.d
Expand Up @@ -22,6 +22,7 @@ class DancingMan {

void setCurAnimation(Animate animation) {
_curAnimation = animation;
_animations[_curAnimation]._animate = true;
}

void animate() {
Expand Down
7 changes: 4 additions & 3 deletions levelScreen.d
Expand Up @@ -28,13 +28,14 @@ class LevelScreen {
_narwhal = new Narwhal();
}

void draw() {
void draw(bool fast) {
move(0,0);
_score.draw();
_spotlight.drawSprite();
_arrowSect.draw();
_arrowSect.draw(fast);
_dancingMan.draw();
_narwhal.animate();
_dancingMan.animate();
}
}

}

0 comments on commit 84e5ca5

Please sign in to comment.