Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. //Draw the game map
  3. //First, we go through the grid of discovered rooms.
  4. var r_x, r_y; //The X/Y coordinates of rooms in the grid
  5. var d_x, d_y; //Where to draw the room on the map the player sees
  6. var is_save_room; //Whether to draw the "save room" marker
  7. var draw_loc; //Whether to draw the "current location" marker
  8. for(r_x = 0; r_x < CO_MAP_WIDTH; r_x += 1)
  9. {
  10.     for(r_y = 0; r_y < CO_MAP_HEIGHT; r_y += 1)
  11.     {
  12.         is_save_room = false;
  13.         draw_loc = false;
  14.         //For this individual room:
  15.         //Calculate drawing coordinates.
  16.         d_x = r_x*16 + room_width/2 - (CO_MAP_WIDTH*16)/2;
  17.         d_y = r_y*16 + room_height/2 - (CO_MAP_HEIGHT*16)/2;
  18.        
  19.         //If the room has been discovered, we draw it.
  20.         if ds_grid_get(discovered_rooms,r_x,r_y) = true draw_sprite(spr_map_discovered,0,d_x,d_y);
  21.        
  22.         //If the location was also registered as a save room, we draw the save icon as well.
  23.         if ds_grid_get(discovered_save_rooms,r_x,r_y) = true is_save_room = true;
  24.        
  25.         //If the player brought up the map to teleport between save point locations...
  26.         if pause_style = "Teleport"//Shitty hack but who cares
  27.         {
  28.             //...and the player's selection arrow is on this cell, and it's a valid save room...
  29.             if (obj_map_selector.x-1 >= d_x && obj_map_selector.x+1 < d_x+16 &&  obj_map_selector.y-1 >= d_y && obj_map_selector.y+1 < d_y+16)
  30.             && is_save_room
  31.             {
  32.                 draw_loc = true;
  33.                 //Set destination coordinates
  34.                 destination_x = r_x;
  35.                 destination_y = r_y;
  36.             }            
  37.         }
  38.         else
  39.         {
  40.         //We're in regular map mode. If this is the current room, draw "current location" marker.
  41.         if r_x == map_x && r_y == map_y draw_loc = true;
  42.         }
  43.        
  44.         if is_save_room draw_sprite(spr_map_save,0,d_x,d_y);
  45.         if draw_loc draw_sprite(spr_map_current,image_index,d_x,d_y);        
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement