Papa Doge
Member
I'm working on a top down shooter that includes a mini map. For my mini map I'm using the technique outline in this tutorial...
The tl;dr on the tutorial is that he takes a screenshot of the game room with all the dynamically positioned objects hidden, crops the result so it's the same aspect ratio as the room, then creates a static background sprite for the mini map and draws the dynamic pieces on top.
I have 5 different objects that I am drawing dynamically on top of this mini map and they are all showing up in the right places and displaying the appropriate logic to mirror the room environment.
However, I have a couple issues...
1) The sprite that I am using for the mini map is for some reason also showing up on my parallax "space" layer which is a transparency over a solid background.
2) No matter what color options I select for the function draw_sprite_ext() I see grayscale representations on my mini map.
I've added a screenshot to illustrate the problems I'm seeing. The mini map is in the top right and you can see it being drawn again through the hole in the floor on the bottom left.
Here is the code that I am using for the mini map based on the tutorial...
The tl;dr on the tutorial is that he takes a screenshot of the game room with all the dynamically positioned objects hidden, crops the result so it's the same aspect ratio as the room, then creates a static background sprite for the mini map and draws the dynamic pieces on top.
I have 5 different objects that I am drawing dynamically on top of this mini map and they are all showing up in the right places and displaying the appropriate logic to mirror the room environment.
However, I have a couple issues...
1) The sprite that I am using for the mini map is for some reason also showing up on my parallax "space" layer which is a transparency over a solid background.
2) No matter what color options I select for the function draw_sprite_ext() I see grayscale representations on my mini map.
I've added a screenshot to illustrate the problems I'm seeing. The mini map is in the top right and you can see it being drawn again through the hole in the floor on the bottom left.
Here is the code that I am using for the mini map based on the tutorial...
Code:
/* -------------------- */
// DRAW PLAYER
if (instance_exists(obj_player_bottom)) { // IF the player is still alive...
// Set X and Y of the mini map player to match the scale of the mini map...
player_x = obj_player_bottom.x*mini_map_percentage;
player_y = obj_player_bottom.y*mini_map_percentage;
draw_sprite_ext(spr_player_bottom,0,x+player_x,y+player_y,mini_map_percentage,mini_map_percentage,obj_player_bottom.image_angle,c_white,0.8); // Draw the player to the mini map
}
/* -------------------- */
// DRAW ENEMIES
if (instance_exists(obj_enemy_alive)) { // IF there are any living enemies in the room...
with(obj_enemy_alive) { // WITH every instance of a living enemy...
// Set the X and Y of this enemy to match the mini map's percentage...
var enemy_x = x * other.mini_map_percentage;
var enemy_y = y * other.mini_map_percentage;
// Then draw a representation of the enemy using all the defaults for this living enemy...
draw_sprite_ext(sprite_index,image_index,other.x+enemy_x,other.y+enemy_y,other.mini_map_percentage,other.mini_map_percentage,image_angle,c_red,0.8);
}
}
/* -------------------- */
// DRAW SENTRIES
if (instance_exists(obj_sentry_bottom)) { // IF there are any working sentries in the room...
with(obj_sentry_bottom) { // WITH every instance of a working sentry...
// Set the X and Y of this sentry to match the mini map's percentage...
var sentry_x = x * other.mini_map_percentage;
var sentry_y = y * other.mini_map_percentage;
// Then draw a representation of the sentry using all the defaults for this working sentry...
draw_sprite_ext(sprite_index,image_index,other.x+sentry_x,other.y+sentry_y,other.mini_map_percentage,other.mini_map_percentage,image_angle,c_teal,0.8);
}
}
/* -------------------- */
// DRAW CROPS
if (instance_exists(obj_crop_berries_alive)) { // IF there are any living crops in the room...
with(obj_crop_berries_alive) { // WITH every instance of a living crop...
// Set the X and Y of this crop to match the mini map's percentage...
var sentry_x = x * other.mini_map_percentage;
var sentry_y = y * other.mini_map_percentage;
// Then draw a representation of the crop using all the defaults for this living crop...
draw_sprite_ext(sprite_index,image_index,other.x+sentry_x,other.y+sentry_y,other.mini_map_percentage,other.mini_map_percentage,image_angle,c_green,0.8);
}
}
/* -------------------- */
// DRAW PORTALS
if (instance_exists(obj_portal)) { // IF there are any portals in this room...
with(obj_portal) { // WITH every instance of am open portal...
// Set the X and Y of this portal to match the mini map's percentage...
var portal_x = x * other.mini_map_percentage;
var portal_y = y * other.mini_map_percentage;
// Then draw a representation of the portal using all the defaults for this open portal...
draw_sprite_ext(sprite_index,image_index,other.x+portal_x,other.y+portal_y,other.mini_map_percentage,other.mini_map_percentage,image_angle,c_red,0.8);
}
}
/* -------------------- */
// DRAW MINI MAP
draw_sprite_ext(spr_mini_map,0,x,y,1,1,0,c_white,0.2); // Draw the mini map to the screen with some transparency...
Attachments
-
67.9 KB Views: 10