Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 how do you make a mini map?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Shyfire




PostPosted: Sun Jun 26, 2005 11:51 pm   Post subject: how do you make a mini map?

could some on show me some code on how to make a mini map
Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Mon Jun 27, 2005 9:04 am   Post subject: (No subject)

You just make a smaller representation of your gameplay map onto a different screen.

I dont have time to explain all the code, but here it is.

The minimap's movement is scaled down by 20. I'm sure you can figure it all out

code:
var playwindow : int := Window.Open ("graphics:500;500,nobuttonbar,position:top,left,offscreenonly")
colorback (black)
var minimap : int := Window.Open ("graphics:200;200,nobuttonbar,position:top,right,offscreenonly,title:Minimap")
colorback (2)
var key : array char of boolean
var startx, starty : int := 100
var x, y : int := 250
var minix, miniy : int := x

procedure refresh
    Window.Select (playwindow)
    colorback (black)
    cls
    if key (KEY_LEFT_ARROW) then
        startx += 5
    elsif key (KEY_RIGHT_ARROW) then
        startx -= 5
    elsif key (KEY_UP_ARROW) then
        starty -= 5
    elsif key (KEY_DOWN_ARROW) then
        starty += 5
    end if
    drawline (startx, 0, startx, maxy, white)
    drawline (0, starty, maxx, starty, white)
    drawfilloval (startx, starty, 5, 5, white)
    drawfilloval (x, y, 10, 10, 12)
    color (white)
    locate (1, 1)
    put "X - Difference: ", startx - x ..
    locate (2, 1)
    put "Y - Difference: ", starty - y ..
    View.Update
    Window.Select (minimap)
    cls
    colorback (2)
    drawline (maxx div 2, 0, maxx div 2, maxy, white)
    drawline (0, maxy div 2, maxx, maxy div 2, white)
    drawfilloval (maxx div 2, maxy div 2, 2, 2, white)
    minix := round (100 - ((startx - x) / 20))
    miniy := round (100 - ((starty - y) / 20))
    drawfilloval (minix, miniy, 2, 2, 12)
    View.Update
end refresh

loop
    Input.KeyDown (key)
    refresh
    delay (10)
end loop
Delos




PostPosted: Mon Jun 27, 2005 9:27 am   Post subject: (No subject)

Well, it all depends on how your original map works. jamonathin's method isn't too bad - though for a more detailed map you'd likely use a series of Pic.New()'s and Pic.Scale()'s.
Another possibility (if your map has some grid-like basis to it) would be to assign a specific colour/shape to each type of object on your screen and display them on your map. For example, traversable terrain could be green, non-traversable could be brown, your player could be an arrow pointing in the direction of movement, etc etc.
This would be pretty easy to pull off if you already had your entire map stored as grid-pieces in an array.
Shyfire




PostPosted: Mon Jun 27, 2005 10:36 am   Post subject: (No subject)

thx this helped alot
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: