Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- //Draw the game map
- //First, we go through the grid of discovered rooms.
- var r_x, r_y; //The X/Y coordinates of rooms in the grid
- var d_x, d_y; //Where to draw the room on the map the player sees
- var is_save_room; //Whether to draw the "save room" marker
- var draw_loc; //Whether to draw the "current location" marker
- for(r_x = 0; r_x < CO_MAP_WIDTH; r_x += 1)
- {
- for(r_y = 0; r_y < CO_MAP_HEIGHT; r_y += 1)
- {
- is_save_room = false;
- draw_loc = false;
- //For this individual room:
- //Calculate drawing coordinates.
- d_x = r_x*16 + room_width/2 - (CO_MAP_WIDTH*16)/2;
- d_y = r_y*16 + room_height/2 - (CO_MAP_HEIGHT*16)/2;
- //If the room has been discovered, we draw it.
- if ds_grid_get(discovered_rooms,r_x,r_y) = true draw_sprite(spr_map_discovered,0,d_x,d_y);
- //If the location was also registered as a save room, we draw the save icon as well.
- if ds_grid_get(discovered_save_rooms,r_x,r_y) = true is_save_room = true;
- //If the player brought up the map to teleport between save point locations...
- if pause_style = "Teleport"//Shitty hack but who cares
- {
- //...and the player's selection arrow is on this cell, and it's a valid save room...
- 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)
- && is_save_room
- {
- draw_loc = true;
- //Set destination coordinates
- destination_x = r_x;
- destination_y = r_y;
- }
- }
- else
- {
- //We're in regular map mode. If this is the current room, draw "current location" marker.
- if r_x == map_x && r_y == map_y draw_loc = true;
- }
- if is_save_room draw_sprite(spr_map_save,0,d_x,d_y);
- if draw_loc draw_sprite(spr_map_current,image_index,d_x,d_y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement