Game Map Problems
Author |
Message |
Spence607
|
Posted: Fri Dec 05, 2008 3:40 pm Post subject: Game Map Problems |
|
|
I'm currently working on the first map of my game, and I need to make it so the character cannot walk over certain areas of the map.. like walls. Here is my code for my first map, not yet finished. All the black areas and below the grey bricks I do not want the character to be able to pass. I have no clue where to even start for this, any help would be greatly appreciated.
For some reason the colorback doesn't want to work in this, oh well no big deal.
Turing: |
setscreen ("offscreenonly")
setscreen ("graphics:1024;768")
procedure DrawMap1
% -----
%}Floor|
% -----
colorback (25)
% ----------
%|Outer Wall|
% ----------
Draw.FillBox (0, 0, 25, 768, black)
Draw.FillBox (0, 0, 1024, 25, black)
Draw.FillBox (0, 743, 1024, 768, black)
Draw.FillBox (999, 0, 1024, 768, black)
Draw.FillBox (100, 0, 125, 400, black)
Draw.FillBox (125, 375, 400, 400, black)
Draw.FillBox (401, 100, 426, 400, black)
% ----------
%|Inner Wall|
% ----------
Draw.FillBox (26, 667, 998, 742, grey)
Draw.Line (26, 667, 998, 667, black)
Draw.Line (25, 692, 1000, 692, black)
Draw.Line (25, 717, 1000, 717, black)
Draw.Line (75, 667, 75, 692, black)
Draw.Line (125, 667, 125, 692, black)
Draw.Line (175, 667, 175, 692, black)
Draw.Line (225, 667, 225, 692, black)
Draw.Line (275, 667, 275, 692, black)
Draw.Line (325, 667, 325, 692, black)
Draw.Line (375, 667, 375, 692, black)
Draw.Line (425, 667, 425, 692, black)
Draw.Line (475, 667, 475, 692, black)
Draw.Line (525, 667, 525, 692, black)
Draw.Line (575, 667, 575, 692, black)
Draw.Line (625, 667, 625, 692, black)
Draw.Line (675, 667, 675, 692, black)
Draw.Line (725, 667, 725, 692, black)
Draw.Line (775, 667, 775, 692, black)
Draw.Line (825, 667, 825, 692, black)
Draw.Line (875, 667, 875, 692, black)
Draw.Line (925, 667, 925, 692, black)
Draw.Line (975, 667, 975, 692, black)
Draw.Line (50, 692, 50, 717, black)
Draw.Line (100, 692, 100, 717, black)
Draw.Line (150, 692, 150, 717, black)
Draw.Line (200, 692, 200, 717, black)
Draw.Line (250, 692, 250, 717, black)
Draw.Line (300, 692, 300, 717, black)
Draw.Line (350, 692, 350, 717, black)
Draw.Line (400, 692, 400, 717, black)
Draw.Line (450, 692, 450, 717, black)
Draw.Line (500, 692, 500, 717, black)
Draw.Line (550, 692, 550, 717, black)
Draw.Line (600, 692, 600, 717, black)
Draw.Line (650, 692, 650, 717, black)
Draw.Line (700, 692, 700, 717, black)
Draw.Line (750, 692, 750, 717, black)
Draw.Line (800, 692, 800, 717, black)
Draw.Line (850, 692, 850, 717, black)
Draw.Line (900, 692, 900, 717, black)
Draw.Line (950, 692, 950, 717, black)
Draw.Line (75, 717, 75, 742, black)
Draw.Line (75, 717, 75, 742, black)
Draw.FillBox (126, 300, 400, 374, grey)
Draw.Line (125, 300, 400, 300, black)
Draw.Line (125, 325, 400, 325, black)
Draw.Line (125, 350, 400, 350, black)
Draw.Line (175, 300, 175, 325, black)
Draw.Line (225, 300, 225, 325, black)
Draw.Line (275, 300, 275, 325, black)
Draw.Line (325, 300, 325, 325, black)
Draw.Line (375, 300, 375, 325, black)
Draw.Line (150, 325, 150, 350, black)
Draw.Line (200, 325, 200, 350, black)
Draw.Line (250, 325, 250, 350, black)
Draw.Line (300, 325, 300, 350, black)
Draw.Line (350, 325, 350, 350, black)
Draw.Line (175, 350, 175, 400, black)
Draw.Line (225, 350, 225, 400, black)
Draw.Line (275, 350, 275, 400, black)
Draw.Line (325, 350, 325, 400, black)
Draw.Line (375, 350, 375, 400, black)
% --------
%|Entrance|
% --------
Draw.FillBox (26, 0, 99, 25, 25)
end DrawMap1
DrawMap1
View.Update
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Fri Dec 05, 2008 3:55 pm Post subject: RE:Game Map Problems |
|
|
you need a 'cls' right after colorback. |
|
|
|
|
|
Spence607
|
Posted: Fri Dec 05, 2008 3:58 pm Post subject: Re: RE:Game Map Problems |
|
|
insectoid @ Fri Dec 05, 2008 3:55 pm wrote: you need a 'cls' right after colorback.
I see, thanks.
Also I was wondering is there some way I could use a for loop for drawing all these lines instead of drawing every single one?
New Code:
Turing: |
setscreen ("offscreenonly")
setscreen ("graphics:1024;768")
procedure DrawMap1
% -----
%|Floor|
% -----
colorback (25)
cls
% ----------------------
%|Vertical Floor Texture|
% ----------------------
Draw.Line (50, 0, 50, 768, black)
Draw.Line (75, 0, 75, 768, black)
Draw.Line (100, 0, 100, 768, black)
Draw.Line (125, 0, 125, 768, black)
Draw.Line (150, 0, 150, 768, black)
Draw.Line (175, 0, 175, 768, black)
Draw.Line (200, 0, 200, 768, black)
Draw.Line (225, 0, 225, 768, black)
Draw.Line (250, 0, 250, 768, black)
Draw.Line (275, 0, 275, 768, black)
Draw.Line (300, 0, 300, 768, black)
Draw.Line (325, 0, 325, 768, black)
Draw.Line (350, 0, 350, 768, black)
Draw.Line (375, 0, 375, 768, black)
Draw.Line (400, 0, 400, 768, black)
Draw.Line (425, 0, 425, 768, black)
Draw.Line (450, 0, 450, 768, black)
Draw.Line (475, 0, 475, 768, black)
Draw.Line (500, 0, 500, 768, black)
Draw.Line (525, 0, 525, 768, black)
Draw.Line (550, 0, 550, 768, black)
Draw.Line (575, 0, 575, 768, black)
Draw.Line (600, 0, 600, 768, black)
Draw.Line (625, 0, 625, 768, black)
Draw.Line (650, 0, 650, 768, black)
Draw.Line (675, 0, 675, 768, black)
Draw.Line (700, 0, 700, 768, black)
Draw.Line (725, 0, 725, 768, black)
Draw.Line (750, 0, 750, 768, black)
Draw.Line (775, 0, 775, 768, black)
Draw.Line (800, 0, 800, 768, black)
Draw.Line (825, 0, 825, 768, black)
Draw.Line (850, 0, 850, 768, black)
Draw.Line (875, 0, 875, 768, black)
Draw.Line (900, 0, 900, 768, black)
Draw.Line (925, 0, 925, 768, black)
Draw.Line (950, 0, 950, 768, black)
Draw.Line (975, 0, 975, 768, black)
Draw.Line (1000, 0, 1000, 768, black)
% ------------------------
%|Horizontal Floor Texture|
% ------------------------
% -----
%|Walls|
% -----
Draw.FillBox (0, 0, 25, 768, black)
Draw.FillBox (0, 0, 1024, 25, black)
Draw.FillBox (0, 743, 1024, 768, black)
Draw.FillBox (999, 0, 1024, 600, black)
Draw.FillBox (100, 0, 125, 400, black)
Draw.FillBox (125, 375, 400, 400, black)
Draw.FillBox (401, 100, 426, 400, black)
Draw.FillBox (401, 100, 550, 125, black)
Draw.FillBox (551, 100, 576, 600, black)
Draw.FillBox (577, 575, 700, 600, black)
Draw.FillBox (775, 575, 1024, 600, black)
Draw.FillBox (999, 600, 1024, 750, black)
% --------
%|Entrance|
% --------
Draw.FillBox (26, 0, 99, 25, 190)
% ----
%|Exit|
% ----
Draw.FillBox (999, 601, 1025, 666, 190)
end DrawMap1
DrawMap1
View.Update
|
|
|
|
|
|
|
DanielG
|
Posted: Sat Dec 06, 2008 7:10 pm Post subject: Re: Game Map Problems |
|
|
you can simplify your vertical floor texture to a single for loop using this:
code: |
for i : 2 .. 40
Draw.Line (25 * i, 0, 25 * i, 768, black)
end for
|
I don't think the rest can be simplified, there being no formula that can be easily used to connect them all. |
|
|
|
|
|
Spence607
|
Posted: Sat Dec 06, 2008 11:12 pm Post subject: Re: Game Map Problems |
|
|
DanielG @ Sat Dec 06, 2008 7:10 pm wrote: you can simplify your vertical floor texture to a single for loop using this:
code: |
for i : 2 .. 40
Draw.Line (25 * i, 0, 25 * i, 768, black)
end for
|
I don't think the rest can be simplified, there being no formula that can be easily used to connect them all.
I see, thanks. |
|
|
|
|
|
Ktomislav
|
Posted: Sun Dec 07, 2008 6:37 am Post subject: Re: Game Map Problems |
|
|
If you don't want the character to be abel to pass black line you could use:
|
|
|
|
|
|
Spence607
|
Posted: Sun Dec 07, 2008 9:11 am Post subject: Re: Game Map Problems |
|
|
Ktomislav @ Sun Dec 07, 2008 6:37 am wrote: If you don't want the character to be abel to pass black line you could use:
Alright, but how exactly? When I enter the code I seem to just get an error. |
|
|
|
|
|
Insectoid
|
Posted: Sun Dec 07, 2008 10:46 am Post subject: RE:Game Map Problems |
|
|
The Turing Walkthrough. There is a whole tutorial on whatdotcolor(). |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Spence607
|
Posted: Wed Dec 10, 2008 8:37 am Post subject: Re: RE:Game Map Problems |
|
|
insectoid @ Sun Dec 07, 2008 10:46 am wrote: The Turing Walkthrough. There is a whole tutorial on whatdotcolor().
I see, went through it but... I don't see how I could use this to solve my problem.
Edit: No longer using walls, so I'm marking this as answered. |
|
|
|
|
|
|
|