Flashing "Press Enter" system
Displaying 1-9 of 9 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
jedi_knight_krazy

I spent quite a while figuring this one out.
Here's how it works:

//Load an integer
int isPressEnter = 1;
//Load the images, you'll need one main title screen, and one "Press Enter" graphic.
int TitleScreen = LoadImage("title.pcx");
int pressEnter = LoadImage("pressEnter.pcx");
//Start a loop until the user presses Enter.
while(!b1)
{
//Blank screen
Render();
//display your title screen
Blit(0,0,TitleScreen,screen);
//If this is between your first and 60th run of the loop...
if(isPressEnter > 0 && isPressEnter < 60)
{
//Display the Press Enter graphic. NOTE: These coordinates are specific to my game.
Blit(113, 226, pressEnter, screen);
//Increase the counter.
isPressEnter = isPressEnter + 1;
}
//or if it's above your 120th run of the loop...
else if (isPressEnter > 120)
{
//Reset the counter
isPressEnter = 1;
}
//or if it's between the 60th and 120th...
else
{
//continue the counter
isPressEnter = isPressEnter + 1;
}
//Show the screen
ShowPage();
//Repeat
}


I'm sorry, I spent a lot of time trying to tab this, and it just doesn't show up on the forums. Hope this helps!

++Krazy++

Edit: I put pre-tags around your code. Nice work, though! -grue

Posted on 2006-10-23 20:12:13 (last edited on 2006-10-23 20:20:14)

mcgrue

Just so you know how to in the future:

< pre>

This is pre-formatted text.
It cares about whitespace.
And also is in a monospaced font
just like you get in a text editor
So everything lines up!

</ pre>

It's a useful little bit of html to know :3

Posted on 2006-10-23 20:23:43 (last edited on 2006-10-23 20:24:04)

jedi_knight_krazy

Ah, thanks a lot! Hope this helps someone!

Posted on 2006-10-23 21:12:32

Interference22

Here's something useful: my function that makes your computer wait a set number of cycles. Very useful for code that is reliant on timing:


// Wait in hundredths of a second. Pauses VC until wait is over.
void Wait(int delay)
{
int t;
t = timer+delay;

while(t > timer)
{
UpdateControls();
}
}

// -----------------------------------------------------------------------

// Wait in hundredths of a second and update the map too.
void WaitUpdate(int delay)
{
int t;
t = timer+delay;

while(t > timer)
{
Render();
ShowPage();
}
}
// -----------------------------------------------------------------------

// Wait in hundredths of a second. Skippable by holding ESC, the
// left mouse button or Enter.
void SkipWait(int delay)
{
if (!b1 && !b3 && !mouse.l) { Wait(delay); }
}

Posted on 2006-10-24 17:56:50

Overkill


// Load the images, you'll need one main title screen,
// and one "Press Enter" graphic.
int TitleScreen = LoadImage("title.pcx");
int pressEnter = LoadImage("pressEnter.pcx");
// Loop until the user presses Enter.
while(!b1)
{
// Overkill: Draws the map to the screen.
Render();
// Overkill: Ensures the screen is ACTUALLY blank.
RectFill(0, 0, ImageWidth(screen), ImageHeight(screen), 0, screen);
// Display your title screen
Blit(0, 0, TitleScreen, screen);
// Overkill: Smooth, throbbing, fade-in/out effect.
// Let the sine of systemtime mess with lucency.
SetLucent(sin(systemtime * 3) * 50 >> 16 + 50);
// Display the Press Enter graphic.
// NOTE: These coordinates are specific to my game.
Blit(113, 226, pressEnter, screen);
// Overkill: Return to normal lucency for drawing routines.
SetLucent(0);
// Show the screen
ShowPage();
}
// Overkill: Don't forget to free your images!
FreeImage(TitleScreen);
FreeImage(pressEnter);

Posted on 2006-10-24 18:42:31 (last edited on 2006-10-24 18:45:59)

zonker6666

And one more example of the same ...

int pressenter=NewImage(TextWidth("PRESS ENTER",0),FontHeight(0);
RectFill(0,0,ImageWidth(pressenter),ImageHeight(pressenter),RGB(255,0,255),pressenter);
PrintString(0,0,pressenter,0,"PRESS ENTER");
while(!key[SCAN_ENTER])
{
RectFill(0,0,ImageWidth(screen),ImageHeight(screen),0,screen);
Silhouette(100,100,RGB(Random(0,255),Random(0,255),Random(0,255)),pressenter,screen);
ShowPage();
}


// on with the show


Overkill: You forgot ShowPage(); in your while loop. That'll cause unpleasant results. >_<

Posted on 2006-10-25 05:57:28 (last edited on 2006-10-25 11:38:53)

zonker6666

And one more example of the same ...

int pressenter=NewImage(TextWidth("PRESS ENTER",0),FontHeight(0);
RectFill(0,0,ImageWidth(pressenter),ImageHeight(pressenter),RGB(255,0,255),pressenter);

while(!key[SCAN_ENTER])
{
RectFill(0,0,ImageWidth(screen),ImageHeight(screen),0,screen);
Silhouette(100,100,RGB(Random(0,255),Random(0,255),Random(0,255)),pressenter,screen);
}


// on with the show

Posted on 2006-10-25 05:59:07

resident

I've always been partial to something like


int toggle = 1;

{
toggle = toggle * -1;
if toggle = TRUE then text( x, y, "PRESS START");
}


Every cycle, the toggle is multiplied by -1. which basically means it flips continuously between -1 and 1 every pass through the loop.

Posted on 2006-10-26 11:14:17 (last edited on 2006-10-26 11:14:38)

jedi_knight_krazy

Hey, good idea, I never thought of that. That and that Wait()function would make a perfect effect!

Posted on 2006-10-26 15:52:18 (last edited on 2006-10-26 15:53:28)


Displaying 1-9 of 9 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.