Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///===STAR GRID===///
- randomize();
- //Clean Up Stars
- if (room = rm_game) {
- with (obj_star) {
- instance_destroy();
- }
- }
- //Initialize Stars (6 Star Variables, 60 Stars)
- starGrid = ds_grid_create(obj_core.starVariables,obj_core.starsAmount);
- starNameList = ds_list_create();
- var gridHeight = ds_grid_height(starGrid);
- //Grid Values (Column)
- obj_core.starNameNr = 0; obj_core.imageIndex = 1;
- obj_core.xPos = 2; obj_core.yPos = 3;
- obj_core.alive = 4; obj_core.discovered = 5;
- //Switch Check
- switch (obj_core.newGame) {
- //LOAD GAME
- case (false):
- //Load Star Grid & List
- ini_open("Star_Grid.ini");
- ds_grid_read(starGrid,ini_read_string("Star Grid","Grid",""));
- ds_list_read(starNameList,ini_read_string("Star Grid","Names",""));
- ini_close();
- //Create Stars
- for (starIndex=0; starIndex<gridHeight; starIndex++) {
- scr_createStars();
- }
- break;
- //NEW GAME
- case (true):
- for (starIndex=0; starIndex<gridHeight; starIndex++) {
- //Add Star Names
- scr_randomNameGenerator();
- randName = obj_core.nameTemp;
- ds_grid_set(starGrid,obj_core.starNameNr,starIndex,starIndex);
- ds_list_add(starNameList,randName);
- //Add Image Index
- randImageIndex = floor(random(obj_core.starSpritesTotal));
- ds_grid_set(starGrid,obj_core.imageIndex,starIndex,randImageIndex);
- //Add X-Positions
- randX = 100+random(room_width-200);
- ds_grid_set(starGrid,obj_core.xPos,starIndex,randX);
- //Add Y-Positions
- randY = 100+random(room_height-200);
- ds_grid_set(starGrid,obj_core.yPos,starIndex,randY);
- //Add Alive Status
- ds_grid_set(starGrid,obj_core.alive,starIndex,1);
- //Add Discovered Status
- ds_grid_set(starGrid,obj_core.discovered,starIndex,0);
- //Create Stars & Transfer Values
- scr_createStars();
- //Save Star Grid & List
- ini_open("Star_Grid.ini");
- ini_write_string("Star Grid","Grid",ds_grid_write(starGrid));
- ini_write_string("Star Grid","Names",ds_list_write(starNameList));
- ini_close();
- }
- //Disable New Game
- obj_core.newGame = false;
- break;
- }
- //Clean Up
- ds_grid_destroy(starGrid);
- ds_list_destroy(starNameList);
Add Comment
Please, Sign In to add comment