
-----------------------------------
darkangel
Thu Feb 28, 2008 5:12 pm

A Map Maker
-----------------------------------
Because no one has posted in the Turing board for several days now i figured, why not?

This is a basic map creation program i made, it has:
-Snap to grid
-Helpful Undo Command
-If wanted, a guideline to show you your partialy made polygon.
-Saves to a file, EFFICIENTLY

Instructions:
Left Click: Makes a point on the grid
Right Click (HOLD): draws the partially drawn polygon
Middle Click: Saves and Exits.
Ctrl Z: Undo

PS: You can change the amount of points in each polygon in the variable "poly" and changing the upper of the variable in record "coo"


Mouse.ButtonChoose ("multibutton")
View.Set ("offscreenonly,nobuttonbar")
colorback (black)
cls
var mx, my, mz, b : int
var c := 1
var ch : array char of boolean
var poly : int := 4                                   % 1 and c < poly+1 and mz = 100 then
        cls
        click
        Draw.FillOval (Line (upper (Line)).x (1), Line (upper (Line)).y (1), 3, 3, black)
        if c > 2 then
            for i : 2 .. c - 1
                Draw.Line (Line (upper (Line)).x (i),
                    Line (upper (Line)).y (i),
                    Line (upper (Line)).x (i - 1),
                    Line (upper (Line)).y (i - 1), black)
                Draw.FillOval (Line (upper (Line)).x (i), Line (upper (Line)).y (i), 3, 3, black)
            end for
        end if
        Draw.Line (Line (upper (Line)).x (c - 1), Line (upper (Line)).y (c - 1), mx, my, black)
        View.Update
        delay (50)
    end if
    if c = poly+1 then
        cls
        new Line, upper (Line) + 1
        click
        Draw.FillPolygon (Line (upper (Line)).x, Line (upper (Line)).y, upper (Line (upper (Line)).x), grey)
        c := 1
        %new Line, upper (Line) + 1
    end if
    if ch (KEY_CTRL) and ch ('z') and upper (Line) > 1 and c = 1 then
        new Line, upper (Line) - 1
        c := 1
        cls
        click
        delay (500)
        Input.Flush
    end if
    /* REDO COMMAND It works but its dangerous.
     if ch (KEY_CTRL) and ch ('y') and upper (Line) > 1 and c = 1 then
     new Line, upper (Line) + 1

     c := 1
     cls
     locate (1, 1)
     put upper (Line)
     click
     delay (500)
     Input.Flush
     end if
     */
end loop
cls

var f : int
open : f, "Coor.txt", put
for i : 1 .. upper (Line) - 1
    Draw.FillPolygon (Line (i).x, Line (i).y, upper (Line (i).x), grey)
    View.Update
    %Input.Pause
    for ii : 1 .. 4
        put : f, Line (i).x (ii), " ", Line (i).y (ii), " | " ..
    end for
    put : f, ""
end for
close : f


-----------------------------------
that-guy
Thu Apr 03, 2008 5:13 pm

Re: A Map Maker
-----------------------------------
I don't mean to be mean here or anything but there are a lot of things in this code that I know a more efficient way of doing. Also, when you save to file, use the write command. Writing works much faster than putting. (Use an array with it).

good job though i guess.

-----------------------------------
Tony
Thu Apr 03, 2008 7:02 pm

Re: A Map Maker
-----------------------------------
there are a lot of things in this code that I know a more efficient way of doing.
This is where you list what those things are...

-----------------------------------
Tallguy
Tue Apr 15, 2008 9:50 am

RE:A Map Maker
-----------------------------------
thats a cool idea, good job, i can several ways u can apply this to different programs

-----------------------------------
r.m_spy
Sat Apr 19, 2008 7:45 pm

RE:A Map Maker
-----------------------------------
I don't understand what this is for?

-----------------------------------
darkangel
Sun Apr 20, 2008 5:03 pm

Re: A Map Maker
-----------------------------------
Basically lets say you wanted to make a overhead shooter game.

Instead of making a picture and doing the very inefficient whatdotcolor() method of collision, you are able to do Math() functions because you know the corners (points) of your obstacles.

plus if you want to make lots of maps for your overhead shooter, whats going to be easier to distribute? A 5-10 kb file? or a 5-10mb BMP?
(my overhead shooter uses big maps too)

-----------------------------------
Nick
Sun Apr 20, 2008 5:08 pm

RE:A Map Maker
-----------------------------------
maybe I'll put my map maker on soon

-----------------------------------
darkangel
Sun Apr 20, 2008 5:09 pm

Re: RE:A Map Maker
-----------------------------------
maybe I'll put my map maker on soon
maybe you should.
