Computer Science Canada

Trouble with Arrays and Processes*ugh*

Author:  Taneru [ Thu May 18, 2006 9:39 am ]
Post subject:  Trouble with Arrays and Processes*ugh*

Alright, for my program, I'm trying to make rapid firing lasers which will continue to move upwards at the same rate(or close to it) even after you fire another shot. With my current coding, I've got the lasers to stay onscreen, but they don't move correctly! One will move upwards correctly, but VERY slowly, and the other seems to loop in one place.

Not sure what I did wrong, but if someone could please explain what my error is, I'm pretty sure I can fix it......hopefully..
Oh right, forgot the code.
code:


process lasers
    for i : 1 .. 20
        rightlaserx (i) := playerx + 35
    end for
    for j : 1 .. 20
        rightlasery (j) := playery + 80
    end for
    for k : 1 .. 20
        leftlaserx (k) := playerx + 90
    end for
    for l : 1 .. 20
        leftlasery (l) := playery + 80
    end for
    if lasercharge >= 1 then
        lasercharge := lasercharge - 1
        fork lasersound
        loop
            for b : 1 .. 20
                for c : 1 .. 20
                    if rightlasery (lasercount (b)) > 500 then
                        exit
                    end if
                    if leftlasery (lasercount2 (c)) > 500 then
                        exit
                    end if
                    Draw.ThickLine (rightlaserx (lasercount (b)), rightlasery (lasercount (b)), rightlaserx (lasercount (b)), rightlasery (lasercount (b)) + 20, 3, brightred)
                    Draw.ThickLine (leftlaserx (lasercount2 (c)), leftlasery (lasercount2 (c)), leftlaserx (lasercount2 (c)), leftlasery (lasercount2 (c)) + 20, 3, brightred)
                    rightlasery (lasercount (b)) := rightlasery (lasercount (b)) + 10
                    leftlasery (lasercount2 (c)) := leftlasery (lasercount2 (c)) + 10
                end for
            end for
        end loop
    end if
end lasers


I haven't posted the entire program, because it uses a bunch of images which I'm rather reluctant to give out at this point. Don't want anyone swiping them for their own use until I've finished the program...

And one last thing. Is my avatar a decent size? Not sure if it needs to be shrunk a bit or not... I can't see it because of these bloody school filters!

Author:  wtd [ Thu May 18, 2006 10:04 am ]
Post subject: 

Your avatar should proabably be a bit narrower.


: