Could someone please point me at a simple easy to follow, text based, tutorial on how to make a very basic “radar screen” for a “HUD”. Something with an example blend would be great.
Thanks in advance
.
Could someone please point me at a simple easy to follow, text based, tutorial on how to make a very basic “radar screen” for a “HUD”. Something with an example blend would be great.
Thanks in advance
.
You can search for “minimap” here and in the game engine resource forum.
Thanks Monster, I did not even know the correct search term!!!
I have been busy yesterday, but I finally got around to following this up. I found an old, slightly broken, link here for 2.4xx and since I know that people are having problems translating into 2.5xx, I thought I would update the script.
Essentially, you position a camera at some distance from the “ship” Then, with the ship in the centre of the cameras view field, you parent the camera to the ship. When you attach the logic bricks with this script, the “M” and “N” keys activate/deactivate the mini-map.
# This script will create a mini-map, (or radar like,) HUD display in the bottom/centre of the pilot window.
# Setting things up
import bge
from Rasterizer import *
# assign controller
controller = bge.logic.getCurrentController()
owner = controller.owner
# assign Dict
Dict = bge.logic.globalDict
# retrieve the relavent flags
dead_pilot = Dict["dead_pilot"]
# assign ON/OFF keys
mini_map_ON = controller.sensors["mini_map_ON"]
mini_map_OFF = controller.sensors["mini_map_OFF"]
if not dead_pilot:
if mini_map_ON.positive:
# calculate minimum and maximum coordinates
X_min = int(getWindowWidth()*0.4)
Y_min = int(getWindowHeight()*0.0)
X_max = int(getWindowWidth()*0.6)
Y_max = int(getWindowHeight()*0.25)
# Set Viewport size
owner.setViewport(X_min,Y_min,X_max,Y_max)
# Show Viewport
owner.useViewport = True
if mini_map_OFF.positive:
# switch mini map OFF
owner.useViewport = False
else:
# dead pilot
owner.useViewport = False
# End script
I have also attached an image of the associated logic bricks
.