"Lost treasure of mBedungu" 100 level puzzle game for RETRO
Dependencies: LCD_ST7735 RetroPlatform mbed
Diff: Game/IntroScreen.cpp
- Revision:
- 1:dcea5500a32d
- Parent:
- 0:f5f961973d01
diff -r f5f961973d01 -r dcea5500a32d Game/IntroScreen.cpp --- a/Game/IntroScreen.cpp Sat Feb 21 06:19:29 2015 +0000 +++ b/Game/IntroScreen.cpp Sun Mar 01 05:32:06 2015 +0000 @@ -1,10 +1,32 @@ +/* + * (C) Copyright 2015 Valentin Ivanov. All rights reserved. + * + * This file is part of the "Lost treasure of mBedungu" game application for Retro + * + * The "Lost treasure of mBedungu" application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + #include "mbed.h" #include "IntroScreen.h" #include "Sprites.h" -//#include "font_OEM.h" #include "Retro.h" +const int letter_tick[8] = { + 0,1,57,0,0,0,7,1 +}; char title[] = { "@SOMEWHERE@IN@SOUTH@\r\n" \ @@ -19,7 +41,7 @@ }; char text2[] = { - "THE@LEGEND@SAIS@THAT\r\n" \ + "@@LEGEND@SAYS@THAT@@\r\n" \ "@@@THE@TOTEMS@ARE@@@\r\n" \ "@@@@HIDDEN@IN@AN@@@@\r\n" \ "@@UNDERGROUND@MAZE@@" @@ -54,7 +76,7 @@ { if( _state == 0 ) { retro.display.clearScreen(); - drawString(0,0, title); + drawString(0,0, title, palette); _state = 1; pText = text1; curText = 0; @@ -62,44 +84,63 @@ x=0; frame = 0; + drawSprite(4,3,12); + drawSprite(5,3,9); + + retro.display.fillRect(0,80,159,127,0); } else if( _state == 1 ) { frame++; + if( (frame % 3) == 0 ) { + sprites[12].Mirrored = !sprites[12].Mirrored; + drawSprite(4,3,12); + } + if( (frame % 2) == 0 ) { - frame = 0; + //frame = 0; if( *pText != 0 ) { -// while( *pText++ == '@' ) -// x+=8; + while( *pText == '@' ) { + drawChar(x, y, *pText++, palette); + x+=8; + } + + + if( *pText == 0 ) + _state = 2; + else { - if( *pText == 13 ) { - x = 0; - pText++; - } else if( *pText == 10 ) { - y += 8; - pText++; - } else { - drawChar(x, y, *pText++); - x+=8; + if( *pText == 13 ) { + x = 0; + pText++; + } else if( *pText == 10 ) { + y += 8; + pText++; + } else { + sfx(letter_tick,0); + + drawChar(x, y, *pText++, palette); + x+=8; + } } } else _state = 2; } } - if(retro.buttons.pressed(BTN_ROBOT)) { + if(retro.pressed(BTN_ROBOT)) { _state = 0; return Game; } - if(retro.buttons.pressed(BTN_SHIP)) { + if(retro.pressed(BTN_SHIP)) { if( _state == 1 ) { - drawString(0, 80, texts[curText]); + drawString(0, 80, texts[curText], palette); _state = 2; } else if( _state == 2 ) { if( curText < 2 ) {