
-----------------------------------
Kodiakwarz
Fri Apr 22, 2011 11:28 am

Bomberman map
-----------------------------------
What is it you are trying to achieve?
So I'm using a 2d array to draw my map and to keep track of the various things on the map
.

What is the problem you are having?
Everything is going well except for some reason that I do not know, is that turing is getting mad at me and decides
to cut off part of the array in the middle.  I've figured out that if I made the actual run window bigger, that it will fix
the problem.  Unfortunatly to fix it, it makes the screen wayyy tooo big and I have too much excess sapce.


Describe what you have tried to solve this problem
I'm still in grade 10 so I dont have much knowledge, but please do not hold back because of my experience, as I am
a fairly quick learner http://compsci.ca/v3/images/smiles/icon_razz.gif


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)





View.Set ('graphics, offscreenonly')
var mapfield : array 1 .. 15, 1 .. 13 of int
var picID : int := Pic.FileNew ("Bomberman map.JPG")
var BlockFile : int := Pic.FileNew ("breakable blocks.JPG")
var UnBlockFile : int := Pic.FileNew ("unbreakable blocks.JPG")
var WalkBlockFile : int := Pic.FileNew ("walkable field.JPG")
var fileID : int
open : fileID, "bombermanF.txt", get

for i : 1 .. 13
    for a : 1 .. 15
        get : fileID, mapfield (a, i)
    end for
end for




procedure field
    Pic.Draw (picID, 0, 0, 0)
end field

loop

    % field



    for i : 1 .. 13
        for a : 1 .. 15
            if mapfield (a, i) = 1 then
                Pic.Draw (WalkBlockFile, a * 30, i * 28, 0)
            end if
            if mapfield (a, i) = 0 then
                Pic.Draw (UnBlockFile, a * 30, i * 28, 0)
            end if
        end for
        put ""
    end for

    View.Update ()
    delay (5)
    cls ()


end loop



Please specify what version of Turing you are using

 :P  :P  :P

-----------------------------------
Raknarg
Fri Apr 22, 2011 11:51 am

RE:Bomberman map
-----------------------------------
Could you inculde the files with it?

-----------------------------------
Zren
Sat Apr 23, 2011 12:25 am

RE:Bomberman map
-----------------------------------
Get rid of the put statement in the for loop.

Advice:
Make the number of columns/rows a constant, so if you change the size later, you only have to change it in one spot instead of every for loop and stuff.

Some food for though:

var blockPic : array 0 .. 3 of int := init ( % Eg Picture ids
    1234, % Use Pic.FileNew("") instead of numbers
    1235,
    1236,
    1237)

Pic.Draw (
    blockPic (grid (col, row)),
    offsetX + col * cellWidth,
    offsetY + row * cellHeight,
    picCopy)


When grid(col,row) = 0, it will pull the picture id of blockPic(0), etc etc. Way easier than a big if statement.

-----------------------------------
Kodiakwarz
Tue May 31, 2011 9:11 pm

Re: Bomberman map
-----------------------------------
Hey guys srry it took me so long to thank you guys for your replies.  I don't go on the computer at home much and my school's ip is banned from logging into compsci so I could log in to reply loool.  I realized that I had a (put " ") in the for loop I used to draw my tiles which created the space x] oopz :P

-----------------------------------
Kodiakwarz
Tue May 31, 2011 9:12 pm

Re: RE:Bomberman map
-----------------------------------
Get rid of the put statement in the for loop.

Advice:
Make the number of columns/rows a constant, so if you change the size later, you only have to change it in one spot instead of every for loop and stuff.

Some food for though:

var blockPic : array 0 .. 3 of int := init ( % Eg Picture ids
    1234, % Use Pic.FileNew("") instead of numbers
    1235,
    1236,
    1237)

Pic.Draw (
    blockPic (grid (col, row)),
    offsetX + col * cellWidth,
    offsetY + row * cellHeight,
    picCopy)


When grid(col,row) = 0, it will pull the picture id of blockPic(0), etc etc. Way easier than a big if statement.

thanks this helped x]
