Re: Delays in Programs
- Posted by Irv Mullins <irv at ELLIJAY.COM> Nov 21, 1999
- 472 views
----- Original Message ----- From: Longlifter <LONGLIFTER at PRODIGY.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Sunday, November 21, 1999 8:15 PM Subject: Re: Delays in Programs > (I am trying to start my game with the company name and delay it for a few > seconds then change to the second page using virtual screens. Can you help > me?) > without warning > without type_check > > include font.e > include graphics.e > include ecstacy.e > include image.e > include get.e > include mode19.e > > -- declarations > object junk > atom delay > > integer cargo22,festus18,arial08 > > > > -- defines > > > -- go to mode 19 > junk=graphics_mode(19) > > tick_rate(100) > > --force use of vesa standard > machine_proc(36,1) > -- crash message > crash_message("An unexpected error has occured.\n"& > "Contact longlifter at prodigy.net\n"& > "Do not delete the file \"ex.err\"") > > --1 > -- Write Company name to the screen-- > -- set background color > bk_color(BLACK) > -- load font of choice > cargo22 = load_font ("cargo22.f") > festus18=load_font("festus18.f") > arial08=load_font("arial08.f") > -- set the attributes for the text > set_attributes(SHADOW) > -- select a loaded font > select_font (cargo22) > --set text color > set_foreground(BLUE) > -- set background for text > set_background(CLEAR) > -- set x and y positions for text > setx(30) sety(80) > -- write to screen BLACK BIRD GAMES > write("BLACK BIRD GAMES") > --------------------------------------------- > > --2 > -- Write "presents....." below "BLACK BIRD GAMES" > -- select a loaded font > select_font(festus18) > -- set text color > set_foreground(WHITE) > -- set attributes > set_attributes(SHADOW) > -- set background for text > set_background(CLEAR) > -- set x and y positions for text > setx(90) sety(130) > -- write "presents....." to the screen > write("presents.....") > -------------------------------------------- > set_active_page(1) > clear_screen() > > > select_font(arial08) -- select arial font > set_foreground(WHITE) -- set text color to white > set_background(CLEAR) -- set background for text > set_attributes(SHADOW) -- set attributes for text > setx(0) sety(320) -- set x and y positions for text > write("Copyright(c)1999") -- write Copyright information. > > -- Here is where I tried to use your code, but I can't get it to work > -- properly. > procedure wait(atom delay) > atom start, fini > start = time() -- now > fini = start + delay > while time() < fini do > end while -- loop > end procedure > > set_display_page(1) -- screen output will now be displayed Well, of course not, if you put it where your message indicates. The wait() routine, along with other utility routines, needs to go near the top of the program. You 'll be calling those routines from various places. Also, I can't see anyplace where you inserted a call to wait() between the three screens. It won't wait unless you tell it to :) Using set_active_page: A side note: I would try to break up the long chunks of code into smaller, easier to handle modules - something like the following: -- includes -- set crash message -- load fonts: constant festus = load_font("festus18.f") etc. -- select vga mode or abort procedure wait (atom seconds) ..... end procedure .... more utility stuff procedure ShowIntro1 () -- put intro part 1 screen code here end procedure procedure ShowIntro2 () -- put intro part 2 screen code here end procedure procedure LoadCopyright() -- put copyright code here -- which loads to page 1 end procedure -- more procedures having to do with game operations --Here's the main logic flow: ShowIntro1() -- Company name on page 0 wait(5) -- delay 5 seconds before printing the "presents" ShowIntro2() LoadCopyright() -- go ahead and load page 1 with the copyright notice wait(7) -- but wait 7 seconds before switching pages set_display_page(1) -- now flip to copyright page. wait(5) InitializeGame() while not finished do -- main game loop goes here, calling various game functions and procedures -- defined above, until done end while --Clean up and exit code goes here Regards, Irv