NathansSandbox

scr_starsDraw (Ep. 16)

Jul 17th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///====STARS====///
  2. //Draw Stars
  3. draw_self();
  4. //Discovered Status
  5. if (self.discovered = true) {
  6.     image_index = self.imageIndex;
  7.     draw_set_colour(c_white);
  8.     draw_set_halign(fa_center);
  9.     draw_text_transformed(x+sprite_width/2,y+sprite_height+1,string(self.starName),0.8,0.8,0);
  10. } else {
  11.     image_index = obj_core.starSpritesTotal;
  12. }
  13. //User Interaction
  14. if (mouse_x>x and mouse_x<x+sprite_width and mouse_y>y and mouse_y<y+sprite_height) {
  15.     //Discovered Pop Up
  16.     if (self.discovered = true) {
  17.         //Display Star Properties
  18.     } else {
  19.         draw_set_colour(c_white);
  20.         draw_set_halign(fa_center);
  21.         draw_text_transformed(x+sprite_width/2,y+sprite_height+1,"Unknown: "+string(self.starName),0.8,0.8,0);
  22.     }
  23.     //Click Action
  24.     if (mouse_check_button_released(mb_left)) {
  25.         //Temp Dev Tool
  26.         self.discovered = true;
  27.         //Load Grid
  28.         starGrid = ds_grid_create(obj_core.starVariables,obj_core.starsAmount);
  29.         ini_open("Star_Grid.ini");
  30.         ds_grid_read(starGrid,ini_read_string("Star Grid","Grid",""));
  31.         ini_close();
  32.         //Replace Values
  33.         ds_grid_set(starGrid,obj_core.discovered,self.starIndex,1);
  34.         //Unload
  35.         ini_open("Star_Grid.ini");
  36.         ini_write_string("Star Grid","Grid",ds_grid_write(starGrid));
  37.         ini_close();
  38.         ds_grid_destroy(starGrid);
  39.     }
  40. }
Add Comment
Please, Sign In to add comment