Initial publish
Dependencies: mbed
Fork of el17dg by
Diff: main/main.cpp
- Revision:
- 20:557e84189a57
- Parent:
- 19:b78fa41d04a9
- Child:
- 21:0eb394495b8a
--- a/main/main.cpp Thu Mar 21 15:12:07 2019 +0000 +++ b/main/main.cpp Tue Mar 26 10:52:53 2019 +0000 @@ -34,7 +34,11 @@ }; IntroMove lineOne; +IntroMove lineOneStars; IntroMove lineTwo; +IntroMove lineTwoShips; +IntroMove lineThree; + //static const unsigned int MAX_LINE_LENGTH = 14; @@ -96,6 +100,7 @@ wait(0.5); led_state = !led_state; } + //game.gameValuesInit(); current_screen = ScreenOption_Menu; } @@ -105,15 +110,59 @@ } void intro(){ - lineOne.x = -63; - lineOne.y = 2; // This just will be an intro for the game.////////////////// + lineOne.x = -63; // The width of the sprite. + lineOne.y = 1; // This just will be an intro for the game.////////////////// + lineOneStars.x = screen_width; + lineOneStars.y = 1; - for (int i = 0; i < 67; i++){ + lineTwo.y = 15; + lineTwo.x = screen_width; + lineTwoShips.x = -46; // Starting position outside the screen limits, with the length of the sprite. + lineTwoShips.y = 14; // the height of the "The last One" and a few pixels for gaps. + + lineThree.x = 2; + lineThree.y = screen_height; // Starting outside the screen limits on the botto - the screen's height + the sprite's height. + + // the width of the lione one + 2. + for (int i = 0; i < 65; i++){ lcd.clear(); - lcd.drawSprite(lineOne.x + i, lineOne.y, 11, 63, (int*)introLineOne); + lineOne.x +=1; + if (lineOneStars.x > 70){ + lineOneStars.x -= 1; + } + // to stop moving at the position of its width. + if (lineTwo.x > screen_width - 30){// + lineTwo.x -=1; + } + if ( lineTwoShips.x < 0){ + lineTwoShips.x += 1; + } + + lcd.drawSprite(lineOne.x, lineOne.y, 11, 63, (int*)introLineOne); + lcd.drawSprite(lineOneStars.x, lineOneStars.y, 13, 12, (int*)introLineOneStars); + lcd.drawSprite(lineTwo.x, lineTwo.y, 11, 30, (int*)introLineTwo); + lcd.drawSprite(lineTwoShips.x, lineTwoShips.y, 10, 46, (int*)introLineTwoShips); + lcd.refresh(); - wait(0.00001); - } + wait(0.01); + } + + //Stop just a few pixels above the bottom screen border. + for (int i = 0; i < 19 + 3; i++){ + lcd.clear(); + + lcd.drawSprite(lineOne.x, lineOne.y, 11, 63, (int*)introLineOne); + lcd.drawSprite(lineOneStars.x, lineOneStars.y, 13, 12, (int*)introLineOneStars); + lcd.drawSprite(lineTwo.x, lineTwo.y, 11, 30, (int*)introLineTwo); + lcd.drawSprite(lineTwoShips.x, lineTwoShips.y, 10, 46, (int*)introLineTwoShips); + + lcd.drawSprite(lineThree.x, lineThree.y - i, 19, 78, (int*)introLineThree); + + lcd.refresh(); + wait(0.1); + } + while (!gamepad.check_event(gamepad.START_PRESSED)){ + } /*lcd.printString(" StarBarians",1,1); lcd.refresh(); wait(0.5);