I'm making a Falldown clone for the Prizm. Smile I've already made it randomly generate rows of blocks, next I'll have to add the ball and collision detection.


Download
Great looking sprites! I'll be following this project avidly, of course; let us/me know if you need any Prizm-specific C help.
Very nice start! Smile I'd love to see a falldown clone for the prizm, and as Kerm said, if you need any help at all we're here for that. Good luck!
NIce sprites, try adding borders!

Collision detection works for the most part, there are still a few graphical glitches. Also, how would I draw sprites with transparency?
Download
souvik1997 wrote:
Also, how would I draw sprites with transparency?


see this topic in omnimaga: http://ourl.ca/111600

and Routine: Draw Alpha-coded sprite by ashbad: http://www.cemetech.net/forum/viewtopic.php?t=6114&start=20
I would indeed use my routine for call-time alpha transparency (it applies to the whole image though, but it does take a masking parameter), or just the normal CopySpriteMasked by KermMartian: http://www.cemetech.net/forum/viewtopic.php?t=6114&postdays=0&postorder=asc&start=42
Ashbad wrote:
I would indeed use my routine for call-time alpha transparency (it applies to the whole image though, but it does take a masking parameter), or just the normal CopySpriteMasked by KermMartian: http://www.cemetech.net/forum/viewtopic.php?t=6114&postdays=0&postorder=asc&start=42
Yup, either of these would be best. Cemetech's Useful Routine thread has almost everything you need to know for sprites with 1-bit masks and with alpha masking.
Looks nice. I like the nice ability to penetreate platforms.
I want the program to repeat when the F3 key is pressed after the user lost, but it isn't working.

Code:
void main(void) {
   Bdisp_EnableColor(1);
   int lostGame;
   int takeScreenShot;
   int key;
   int exit;
   int Timer_createNewRow;
   
   while (1) {
      lostGame = 0;
      takeScreenShot = 0;
      key = 0;
      exit = 0;   
      Timer_createNewRow = 0;   
      while (!exit)
      {
         Bdisp_AllClr_VRAM();
         Timer_createNewRow++;
         if (Timer_createNewRow >= TIMER_CREATE_NEW_ROW)
         {
            generateBlocks();
            Timer_createNewRow = 0;
         }
         updateRows();
         displayBlocks();
         updateBallYPosition();
         key = GetKeyNB();
         switch (key)
         {
            case KEY_PRGM_LEFT:
               XPosition-=BALL_MOVEMENT_INTERVAL;
               if (checkCollision())
               {
                  XPosition+=BALL_MOVEMENT_INTERVAL;
                  break;
               }
               if (XPosition < 0)
                  XPosition = 0;
               currentBallFrame++;
               if (currentBallFrame == 5)
                  currentBallFrame = 1;
               
               if (XPosition < 0)
                  XPosition = 0;
               break;
            case KEY_PRGM_RIGHT:
               XPosition+=BALL_MOVEMENT_INTERVAL;
               if (checkCollision())
               {
                  XPosition-=BALL_MOVEMENT_INTERVAL;
                  break;
               }
               if (XPosition > LCD_MAX_WIDTH-BALL_WIDTH)
                  XPosition = LCD_MAX_WIDTH-BALL_WIDTH;
               currentBallFrame--;
               if (currentBallFrame == 0)
                  currentBallFrame = 4;
               if (XPosition > LCD_MAX_WIDTH)
                  XPosition = LCD_MAX_WIDTH;
               break;
            case KEY_PRGM_F6:
               takeScreenShot = 1;
            case KEY_PRGM_SHIFT:
               exit = 1;
               break;
                     
         }
         if (YPosition > LCD_MAX_HEIGHT-BALL_HEIGHT)
            YPosition = LCD_MAX_HEIGHT-BALL_HEIGHT;
         if (YPosition <= 0)
         {
            exit = 1;
            lostGame = 1;            
         }
         char* ballToDraw;
         if (currentBallFrame == 1)
            ballToDraw = ball_f1;
         else if (currentBallFrame == 2)
            ballToDraw = ball_f2;
         else if (currentBallFrame == 3)
            ballToDraw = ball_f3;
         else if (currentBallFrame == 4)
            ballToDraw = ball_f4;
         CopySpriteMasked(ballToDraw, XPosition, YPosition+7, BALL_WIDTH, BALL_HEIGHT, COLOR_WHITE); //draws the ball
         Bdisp_PutDisp_DD();
         score+=50;
         if (takeScreenShot == 1)
         {
            key = 0;
            GetKey(&key);
         }
      }
      if (lostGame)
      {
         key = 0;
         
         while (key !=KEY_PRGM_F3){
            Bdisp_AllClr_VRAM();
            char* s = "  You lost!";      
            PrintXY(1,1,s,TEXT_MODE_NORMAL,TEXT_COLOR_RED);
            char* s2 = "  Score:";
            PrintXY(1,2,s2,TEXT_MODE_NORMAL,TEXT_COLOR_BLUE);
            char t[12];
            itoa(score, t+2);
            PrintXY(9,2,t,TEXT_MODE_NORMAL,TEXT_COLOR_PURPLE);
            char* s3 = "  [F3] to play again";
            PrintXY(1,3,s3,TEXT_MODE_NORMAL,TEXT_COLOR_BLACK);
            GetKey(&key);   
         }
         Bdisp_AllClr_VRAM();
         Bdisp_PutDisp_DD();         
      }
   }
   return;   
   
   
}
well, in that last chunk of code, you check for the key with GetKey(&key) ... why not PRGM_GetKey or something better?
I don't think that's the problem, though. Even if I change that, I don't think it would repeat.
Oh, just looking at your game, I noticed that there is a higher probability for there to be a blank on the left side of the screen than anywhere else. You might want to fix your algorithm.
seana11 wrote:
Oh, just looking at your game, I noticed that there is a higher probability for there to be a blank on the left side of the screen than anywhere else. You might want to fix your algorithm.

Nice catch. Smile I've just fixed that in this build.
http://dl.dropbox.com/u/3601919/upload/Falldown.g3a
Can you be more specific about the failure mode of your code? With a quick glance, I don't see anything wrong with your loop structure, although I agree you should be using PRGM_GetKey() with KEY_PRGM_*.
KermMartian wrote:
Can you be more specific about the failure mode of your code? With a quick glance, I don't see anything wrong with your loop structure, although I agree you should be using PRGM_GetKey() with KEY_PRGM_*.

Pressing F3 doesn't do anything, it seems to be stuck in a GetKey() or something because the Shift and Alpha keys work, but it doesn't repeat. You can see this when you lose in my latest build of Falldown.
Ashbad wrote:
well, in that last chunk of code, you check for the key with GetKey(&key) ... why not PRGM_GetKey or something better?

Something better Wink
PierrotLL wrote:
Ashbad wrote:
well, in that last chunk of code, you check for the key with GetKey(&key) ... why not PRGM_GetKey or something better?

Something better Wink


Indeed, that's a lot better, and what I was getting at; even better than that, I made/use this: http://prizm.cemetech.net/index.php?title=Debouncing_Multiple-Keypress_PRGM_GetKey
Looks nice, although that was kinda odd at first to see a grayscale game arrive on a color screen calculator Razz
DJ_O wrote:
Looks nice, although that was kinda odd at first to see a grayscale game arrive on a color screen calculator Razz
Just because we have all the colors doesn't mean that every game has to look like someone pinned a few rainbows to our calculators. Very Happy I personally think the grayscale look is nice and simple and classy.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement