Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 3rd, 2012  |  syntax: None  |  size: 2.34 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. CurrentWorld = 0 ;
  2.  
  3. //Set the two arrays up
  4. // Each World array holds a room_index
  5.  
  6. //Fire Worlds
  7. FireWorld[0] = rm_fire_one ;
  8. FireWorld[1] = rm_fire_two ;
  9. FireWorld[2] = -5 ;
  10.  
  11.  
  12. //Ice Worlds
  13. IceWorld[0] = rm_ice_one;
  14. IceWorld[1] = rm_ice_two;
  15. IceWorld[2] = -5 ;
  16.  
  17.  
  18.  
  19. //Create The Grids
  20. //These grids hold where it is safe to switch too in there respective worlds
  21. FireGrid[0] = ds_grid_create(room_width/32,room_height/32) ;
  22. IceGrid[0]  = ds_grid_create(room_width/32,room_height/32) ;
  23. FireGrid[1] = ds_grid_create(room_width/32,room_height/32) ;
  24. IceGrid[1]  = ds_grid_create(room_width/32,room_height/32) ;
  25.  
  26.  
  27. FileName = "ProjectSolomon.wgd" ;
  28. if(file_exists(FileName)) // Read the contents
  29.     {
  30.     /*
  31.     ** Format
  32.     ** Fire World Grid (String)
  33.     ** Ice  World Grid (String)
  34.     ** And So On
  35.     */
  36.     File = file_text_open_read(FileName) ;
  37.     var i ; i = 0 ;
  38.     do
  39.         {
  40.         switch(i mod 2)
  41.             {
  42.             case 0 :
  43.                     {
  44.                     FireGrid[floor(i/2)] = ds_grid_read(FireGrid[floor(i/2)],file_text_read_string(File)) ;
  45.                    }
  46.                     ;break;
  47.             case 1 :
  48.                     {
  49.                     IceGrid[floor(i/2)] = ds_grid_read(IceGrid[floor(i/2)],file_text_read_string(File)) ;
  50.                     }
  51.                     ;break;
  52.             }
  53.         file_text_readln(File) ;
  54.         i+=1 ;
  55.         }
  56.     until(file_text_eof(File) || i > 10000)
  57.     }
  58. else // Create the file and its contents
  59.     {
  60.     File = file_text_open_write(FileName) ;
  61.     var i ; i = 0 ;
  62.     // Basically just flick between rooms and survey the level
  63.     do
  64.         {
  65.             room_goto(FireWorld[i]) ;
  66.             show_message(string(room) + " || " +  string(FireWorld[i]))
  67.             FireGrid[i] = WorldGridSetUp(FireGrid[i]) ;
  68.             room_goto(IceWorld[i]);
  69.             IceGrid[i] = WorldGridSetUp(IceGrid[i]) ;
  70.             show_message(string(room) + " || " +  string(IceWorld[i]))
  71.             //Write the Grids
  72.             file_text_write_string(File,ds_grid_write(FireGrid[i])) ;
  73.             file_text_writeln(File) ;
  74.             file_text_write_string(File,ds_grid_write(IceGrid[i])) ;
  75.             file_text_writeln(File) ;
  76.             i+=1 ;
  77.         }
  78.     until(FireWorld[i] == -5 || i > 10000)
  79.     room_goto(IceWorld[0]) ;
  80.     }