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

Username:   Password: 
 RegisterRegister   
 GW's Jet Game Yaaay Flashiness
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GOLDEN WEAPON




PostPosted: Tue Jun 10, 2003 5:38 pm   Post subject: GW's Jet Game Yaaay Flashiness

Ok I've made 2 previous posts about my game. One was about slowness nad I forget what the other was about but anyway, since my last post my game has doubled in size and has had many new features added. Today I wrote some code that used about 6 or 7 arrays and for loops to draw the lines of enemies on the screen. The code works perfectly but there is one problem. Some of the enemy ships are flashy but some aren't. I've been trying to fix this all day but ... what ever, you get the idea. The whole game is attached, if you want a look.
code:

%Title: Alien Warfare
%Programmers: Andrew Stewart and Matt Redmond
%Graphic Artists : Andrew Stewart and Matt Redmond
%Concept Desginers: Andrew Stewart
%Copyright: May 22, 2003
var x : int := 100
var y : int := 410
var x2 : int := 100
var y2 : int := 70
var jet1nofire : int
var jet2nofire : int
var skipintro : string
var Clouds : int
var Clouds2 : int
var Clouds3 : int
var Clouds4 : int
var Clouds5 : int
var Clouds6 : int
var Clouds7 : int
var Clouds8 : int
var GOBG : int
var GOBG2 : int
var GOBG3 : int
var earth : int
var colourhealth1 : int
var colourhealth2 : int
var comicsansms : int
comicsansms := Font.New ("Comic Sans MS:33")
var comicsansms2 : int
comicsansms2 := Font.New ("Comic Sans MS:20")
var copperplategothicbold : int
copperplategothicbold := Font.New ("Copperplate Gothic Bold:33")
var gamewon : boolean := false
var enemiescountermabob : int := 0
var gun1fire : boolean := false
var gun2fire : boolean := false
var jetalive1 : boolean := true
var jetalive2 : boolean := true
var gamestart : boolean := false
var gameoverfinal : boolean := false
var lastexplosion1 : boolean := false
var lastexplosion2 : boolean := false
var skywidth, skyheight : int := 0
var skywidth2, skyheight2 : int := 0
var skywidth3, skyheight3 : int := 0
var skywidth4, skyheight4 : int := 0
var skyx, skyy : int := 0
var skyxedge : int := 640
var skyyedge : int := 480
var skyxedge2 : int := 1280
var skyxedge3 : int := 1920
var mshipcrystal : int
var earthhole : int

%Drawing the pictures
mshipcrystal := Pic.FileNew ("mothershipcrystal.bmp")
Pic.SetTransparentColour (mshipcrystal, white)
Clouds := Pic.FileNew ("Clouds.jpg")
Clouds2 := Pic.FileNew ("Clouds.jpg")
Clouds2 := Pic.Mirror (Clouds2)
Clouds3 := Pic.FileNew ("Clouds.jpg")
Clouds3 := Pic.Flip (Clouds3)
Clouds4 := Pic.FileNew ("Clouds.jpg")
Clouds4 := Pic.Flip (Clouds4)
Clouds4 := Pic.Mirror (Clouds4)
Clouds5 := Pic.FileNew ("Clouds.jpg")
Clouds5 := Pic.Flip (Clouds5)
Clouds6 := Pic.FileNew ("Clouds.jpg")
Clouds7 := Pic.FileNew ("Clouds.jpg")
Clouds7 := Pic.Mirror (Clouds7)
Clouds8 := Pic.FileNew ("Clouds.jpg")
Clouds8 := Pic.Flip (Clouds8)
Clouds8 := Pic.Mirror (Clouds8)
earth := Pic.FileNew ("earth2.jpg")
jet1nofire := Pic.FileNew ("jet1nofire.bmp")
Pic.SetTransparentColour (jet1nofire, white)
jet2nofire := Pic.FileNew ("jet2nofire.bmp")
Pic.SetTransparentColour (jet2nofire, white)
GOBG := Pic.FileNew ("aliens.jpg")
GOBG2 := Pic.FileNew ("aliens.jpg")
GOBG2 := Pic.Mirror (GOBG2)
GOBG3 := Pic.FileNew ("aliens.jpg")
earthhole := Pic.FileNew ("earthhole.bmp")
Pic.SetTransparentColour (earthhole, white)
var gameoverquestionmark : boolean := false
var jethealth1 : int := 100
var jethealth2 : int := 100
var playagain : string
var score1 : int := 0
var score2 : int := 0
var bullets : int
var bullets2 : int
var lives1 : int := 3
var lives2 : int := 3
var enemyhigh : int := 9
var enemylow : int := 1


%Declaring the enemy pictures
var enemies : array 1 .. 100 of int
for d : 1 .. 25
    enemies (d) := Pic.FileNew ("ufoshocker.bmp")
end for
for f : 26 .. 50
    enemies (f) := Pic.FileNew ("ufolightfighter.bmp")
end for
for g : 51 .. 75
    enemies (g) := Pic.FileNew ("ufoheavyfighter.bmp")
end for
for h : 76 .. 100
    enemies (h) := Pic.FileNew ("ufobomber.bmp")
end for

const jetradius : int := 20

var enemyx : array 1 .. 100 of int
for cv : 1 .. 100
    enemyx (cv) := 800
end for

var enemyy : array 1 .. 100 of int
for rv : 1 .. 92 by 9
    enemyy (rv) := 10
end for
for ev : 2 .. 93 by 9
    enemyy (ev) := 60
end for
for wv : 3 .. 94 by 9
    enemyy (wv) := 110
end for
for tv : 4 .. 95 by 9
    enemyy (tv) := 160
end for
for iv : 5 .. 96 by 9
    enemyy (iv) := 210
end for
for iv : 6 .. 97 by 9
    enemyy (iv) := 260
end for
for iv : 7 .. 98 by 9
    enemyy (iv) := 310
end for
for iv : 8 .. 99 by 9
    enemyy (iv) := 360
end for
for iv : 9 .. 100 by 9
    enemyy (iv) := 410
end for


var e1 : int
var e2 : int
var e3 : int
var e4 : int
var e5 : int
var e6 : int
var e7 : int
var e8 : int
var e9 : int
var e10 : int
var e11 : int
var e12 : int

e1 := Pic.FileNew ("explosion1.bmp")
Pic.SetTransparentColour (e1, black)
e2 := Pic.FileNew ("explosion2.bmp")
Pic.SetTransparentColour (e2, black)
e3 := Pic.FileNew ("explosion3.bmp")
Pic.SetTransparentColour (e3, black)
e4 := Pic.FileNew ("explosion4.bmp")
Pic.SetTransparentColour (e4, black)
e5 := Pic.FileNew ("explosion5.bmp")
Pic.SetTransparentColour (e5, black)
e6 := Pic.FileNew ("explosion6.bmp")
Pic.SetTransparentColour (e6, black)
e7 := Pic.FileNew ("explosion7.bmp")
Pic.SetTransparentColour (e7, black)
e8 := Pic.FileNew ("explosion8.bmp")
Pic.SetTransparentColour (e8, black)
e9 := Pic.FileNew ("explosion9.bmp")
Pic.SetTransparentColour (e9, black)
e10 := Pic.FileNew ("explosion10.bmp")
Pic.SetTransparentColour (e10, black)
e11 := Pic.FileNew ("explosion11.bmp")
Pic.SetTransparentColour (e11, black)
e12 := Pic.FileNew ("explosion12.bmp")
Pic.SetTransparentColour (e12, black)
var keys : array char of boolean
skywidth := Pic.Width (Clouds)
skyheight := Pic.Height (Clouds)
skywidth2 := Pic.Width (Clouds2)
skyheight2 := Pic.Height (Clouds2)
skywidth3 := Pic.Width (Clouds3)
skyheight3 := Pic.Height (Clouds3)
skywidth4 := Pic.Width (Clouds4)
skyheight4 := Pic.Height (Clouds4)
var totalenemies : int := 0
var lastattack : int := 0
var enemieskilled : int := 1
const enemycounter : int := 4
const timebetweenattacks : int := 5
setscreen ("graphics:max;max,offscreenonly,nocursor,nobuttonbar")
var timeelapsed : int := Time.Elapsed

%Explosion Sounds
process explosionsound1
    loop
        exit when jetalive1 = true
        exit when lastexplosion1 = true
        Music.PlayFile ("explosio.wav")
    end loop
end explosionsound1

process explosionsound2
    loop
        exit when jetalive2 = true
        exit when lastexplosion2 = true
        Music.PlayFile ("explosio.wav")
    end loop
end explosionsound2


%Explosions
process explosion1
    cls
    Pic.Draw (e1, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e2, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e3, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e4, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e5, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e6, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e7, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e8, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e9, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e10, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e11, x - 25, y - 6, picMerge)
    delay (100)
    Pic.Draw (e12, x - 25, y - 6, picMerge)
    delay (100)
    View.Update
end explosion1
process explosion2
    cls
    Pic.Draw (e1, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e2, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e3, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e4, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e5, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e6, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e7, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e8, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e9, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e10, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e11, x2 - 35, y2 - 10, picMerge)
    delay (100)
    Pic.Draw (e12, x2 - 35, y2 - 10, picMerge)
    delay (100)
    View.Update
end explosion2

% The Background
procedure drawscreen
    skyx := skyx - 20
    skyxedge := skyxedge - 20
    skyxedge2 := skyxedge2 - 20
    skyxedge3 := skyxedge3 - 20
    if skyx < -640 then
        skyx := 1900
    end if
    if skyxedge < -640 then
        skyxedge := 1900
    end if
    if skyxedge2 < -640 then
        skyxedge2 := 1900
    end if
    if skyxedge3 < -640 then
        skyxedge3 := 1900
    end if
    cls
    View.Set ("offscreenonly")
    Pic.Draw (Clouds, skyx, skyy, picCopy)
    Pic.Draw (Clouds2, skyxedge, skyy, picCopy)
    Pic.Draw (Clouds3, skyx, skyyedge, picCopy)
    Pic.Draw (Clouds4, skyxedge, skyyedge, picCopy)
    Pic.Draw (Clouds5, skyxedge2, skyyedge, picCopy)
    Pic.Draw (Clouds6, skyxedge2, skyy, picCopy)
    Pic.Draw (Clouds7, skyxedge3, skyy, picCopy)
    Pic.Draw (Clouds8, skyxedge3, skyyedge, picCopy)
    locate (1, 1)
    if jethealth1 > 50 then
        colourhealth1 := 10
    elsif jethealth1 > 20 then
        colourhealth1 := 14
    else
        colourhealth1 := 12
    end if
    if jethealth2 > 50 then
        colourhealth2 := 10
    elsif jethealth2 > 20 then
        colourhealth2 := 14
    else
        colourhealth2 := 12
    end if
    put "Player 1:", "" : 2, "Health: " : 20 ..
    put "" : 6, "Lives: ", lives1, " Score: ", score1
    put "Player 2:", "" : 2, "Health: " : 20 ..
    put "" : 6, "Lives: ", lives2, " Score: ", score2
    drawfillbox (145, 520, 145 + jethealth1, 529, colourhealth1) %NOTE: The health bars might not
    drawfillbox (145, 503, 145 + jethealth2, 512, colourhealth2) %be in the exactly right position
    drawbox (145, 520, 145 + jethealth1, 529, 7)                 %due to monitor size differences.
    drawbox (145, 503, 145 + jethealth2, 512, 7)
    if jetalive1 = true then
        Pic.Draw (jet1nofire, x, y, picMerge)
    elsif jetalive1 = false and lastexplosion1 = false and gameoverfinal = false then
        fork explosion1
        fork explosionsound1
    end if
    if jetalive2 = true then
        Pic.Draw (jet2nofire, x2 - 35, y2 - 10, picMerge)
    elsif jetalive2 = false and lastexplosion2 = false and gameoverfinal = false then
        fork explosion2
        fork explosionsound2
    end if
    View.Update
end drawscreen

%Making the enemies go across the screen THE ENEMY PROCESS
process enemyprocess
    loop
        delay (2000)
        for r : 1 .. 150
            exit when enemyhigh >= 100
            delay (5)
            for h : enemylow .. enemyhigh
                Pic.Draw (enemies (h), enemyx (h), enemyy (h), picMerge)
                enemyx (h) := enemyx (h) - 5
                if enemyx (h) = -56 then
                    score1 := score1 - 50
                    score2 := score2 - 50
                end if
            end for
        end for
        enemylow := enemylow + 9
        enemyhigh := enemyhigh + 9
        lastattack := timeelapsed
        exit when enemyhigh >= 100
    end loop
    View.Update
end enemyprocess

procedure drawscreen2
    colourback (0)
    colour (7)
    cls
    View.Set ("offscreenonly")
    Pic.Draw (Clouds, skyx, skyy, picCopy)
    Pic.Draw (Clouds2, skyxedge, skyy, picCopy)
    Pic.Draw (Clouds3, skyx, skyyedge, picCopy)
    Pic.Draw (Clouds4, skyxedge, skyyedge, picCopy)
    locate (1, 1)
    if jethealth1 > 50 then
        colourhealth1 := 10
    elsif jethealth1 > 20 then
        colourhealth1 := 14
    else
        colourhealth1 := 12
    end if
    if jethealth2 > 50 then
        colourhealth2 := 10
    elsif jethealth2 > 20 then
        colourhealth2 := 14
    else
        colourhealth2 := 12
    end if
    put "Player 1:", "" : 2, "Health: " : 20 ..
    put "" : 6, "Lives: ", lives1, " Score: ", score1
    put "Player 2:", "" : 2, "Health: " : 20 ..
    put "" : 6, "Lives: ", lives2, " Score: ", score2
    drawfillbox (145, 520, 145 + jethealth1, 529, colourhealth1)     %NOTE: The health bars might not
    drawfillbox (145, 503, 145 + jethealth2, 512, colourhealth2)     %be in the exactly right position
    drawbox (145, 520, 145 + jethealth1, 529, 7)                     %due to monitor size differences.
    drawbox (145, 503, 145 + jethealth2, 512, 7)
    if jetalive1 = true then
        Pic.Draw (jet1nofire, x, y, picMerge)
    end if
    if jetalive2 = true then
        Pic.Draw (jet2nofire, x2 - 35, y2 - 10, picMerge)
    end if
    View.Update
end drawscreen2

process opbgmusic
    loop
        exit when gamestart
        Music.PlayFile ("sephroth.mid")
    end loop
end opbgmusic

process gobgmusic
    loop
        exit when gameoverfinal = not true
        Music.PlayFile ("2-15 Conitnue Xg.mid")
    end loop
end gobgmusic


process bgmusic
    var randmusic : int
    randint (randmusic, 1, 3)
    if randmusic = 1 and gameoverquestionmark = false then
        loop
            exit when gameoverquestionmark = true
            Music.PlayFile ("2-14 J-E-N-O-V-A Xg.mid")
        end loop
    elsif randmusic = 2 and gameoverquestionmark = false then
        loop
            exit when gameoverquestionmark = true
            Music.PlayFile ("1-10 Fighting Xg.mid")
        end loop
    elsif randmusic = 3 and gameoverquestionmark = false then
        loop
            exit when gameoverquestionmark = true
            Music.PlayFile ("1-20 Still More Fighitng Xg.mid")
        end loop
    end if
end bgmusic

process mgun1sound
    loop
        exit when gun1fire = false
        Music.PlayFile ("mgun.wav")
    end loop
end mgun1sound

process mgun2sound
    loop
        exit when gun2fire = false
        Music.PlayFile ("mgun.wav")
    end loop
end mgun2sound


process mgun1
    randint (bullets, 1, 5)
    for shot : 1 .. 15
        drawline (x + 22 + shot * 20 + bullets, y + 22, x + 24 + shot * 20 + bullets, y + 22, 12)
        drawline (x + 22 + shot * 20 + bullets, y + 39, x + 24 + shot * 20 + bullets, y + 39, 12)
        drawline (x + 20 + shot * 20 + bullets, y + 22, x + 23 + shot * 20 + bullets, y + 22, 15)
        drawline (x + 20 + shot * 20 + bullets, y + 39, x + 23 + shot * 20 + bullets, y + 39, 15)
        delay (1)
    end for
end mgun1


process mgun2
    randint (bullets2, 1, 5)
    for shot2 : 1 .. 15
        drawline (x2 + 22 + shot2 * 20 + bullets2, y2 + 23, x2 + 24 + shot2 * 20 + bullets2, y2 + 23, 12)
        drawline (x2 + 22 + shot2 * 20 + bullets2, y2 + 41, x2 + 24 + shot2 * 20 + bullets2, y2 + 41, 12)
        drawline (x2 + 20 + shot2 * 20 + bullets2, y2 + 23, x2 + 23 + shot2 * 20 + bullets2, y2 + 23, 15)
        drawline (x2 + 20 + shot2 * 20 + bullets2, y2 + 41, x2 + 23 + shot2 * 20 + bullets2, y2 + 41, 15)
        delay (5)
    end for
end mgun2

process explosion4earth
    Music.PlayFile ("explosio.wav")
end explosion4earth

%Opening Screen
procedure opening
    colour (brightgreen)
    colourback (7)
    cls
    put "Skip intro?"
    put "y/n"
    View.Update
    get skipintro
    if skipintro = "n" then
        Pic.Draw (earth, 250, 250, picCopy)
        Font.Draw ("Alien Warfare", 250, 300, comicsansms, 12)
        View.Update
        delay (3000)
        for t : 1 .. 200 by 5
            cls
            Pic.Draw (earth, 250, 250, picCopy)
            drawfillarc (393, -200 + t, 450, 150, 0, 360, 6)
            drawarc (393, -200 + t, 450, 150, 0, 360, 7)
            Pic.Draw (mshipcrystal, 355, -200 + t, picMerge)
            drawfillbox (355, -100, 435, -51 + t, 6)
            drawline (355, -51 + t, 435, -51 + t, 7)
            drawline (355, -200 + t, 355, -52 + t, 7)
            drawline (435, -200 + t, 435, -52 + t, 7)
            View.Update
        end for
        delay (1000)
        for q : 1 .. 149
            cls
            Pic.Draw (earth, 250, 250, picCopy)
            drawfillarc (393, 0, 450, 150, 0, 360, 6)
            drawfillbox (356, 0, 434, 148, 7)
            drawarc (393, 0, 450, 150, 0, 360, 7)
            Pic.Draw (mshipcrystal, 355, 0, picMerge)
            drawfillbox (355, 0, 435, 149 - q, 6)
            drawline (355, 149 - q, 435, 149 - q, 7)
            drawline (355, 0, 355, 148, 7)
            drawline (435, 0, 435, 148, 7)
            View.Update
        end for
        delay (2000)
        for w : 1 .. 150 by 20
            cls
            Pic.Draw (earth, 250, 250, picCopy)
            drawfillarc (393, 0, 450, 150, 0, 360, 6)
            drawfillbox (356, 0, 434, 148, 7)
            drawarc (393, 0, 450, 150, 0, 360, 7)
            Pic.Draw (mshipcrystal, 355, 0, picMerge)
            drawfillbox (355, 0, 435, 0, 6)
            drawline (355, 0, 435, 0, 7)
            drawline (355, 0, 355, 148, 7)
            drawline (435, 0, 435, 148, 7)
            drawfillbox (393, 130, 395, 131 + w, 12)
            View.Update
        end for
        for m : 1 .. 100 by 20
            cls
            Pic.Draw (earth, 250, 250, picCopy)
            drawfillarc (393, 0, 450, 150, 0, 360, 6)
            drawfillbox (356, 0, 434, 148, 7)
            drawarc (393, 0, 450, 150, 0, 360, 7)
            Pic.Draw (mshipcrystal, 355, 0, picMerge)
            drawfillbox (355, 0, 435, 0, 6)
            drawline (355, 0, 435, 0, 7)
            drawline (355, 0, 355, 148, 7)
            drawline (435, 0, 435, 148, 7)
            drawfillbox (393, 130 + m, 395, 281 + m, 12)
            View.Update
        end for
        fork explosion4earth
        for n : 1 .. 160 by 20
            cls
            Pic.Draw (earth, 250, 250, picCopy)
            Pic.Draw (earthhole, 380, 380, picMerge)
            drawfillarc (393, 0, 450, 150, 0, 360, 6)
            drawfillbox (356, 0, 434, 148, 7)
            drawarc (393, 0, 450, 150, 0, 360, 7)
            Pic.Draw (mshipcrystal, 355, 0, picMerge)
            drawfillbox (355, 0, 435, 0, 6)
            drawline (355, 0, 435, 0, 7)
            drawline (355, 0, 355, 148, 7)
            drawline (435, 0, 435, 148, 7)
            drawfillbox (393, 230 + n, 395, 381, 12)
            View.Update
        end for
    else
    end if
end opening

%The Game
opening
gamestart := true
drawscreen2
Font.Draw ("Ready?", 200, 250, copperplategothicbold, 12)
View.Update
delay (2000)
cls
drawscreen2
Font.Draw ("GO!", 250, 250, copperplategothicbold, 10)
View.Update
delay (750)
cls
drawscreen2
View.Update
loop
    colour (7)
    colourback (0)
    cls
    fork bgmusic
    drawscreen
    fork enemyprocess
    loop
        if jethealth1 <= 0 and jetalive1 = true then
            jetalive1 := false
            fork explosion1
            fork explosionsound1
            if lives1 > 0 then
                jethealth1 := 100
            elsif lives1 = 0 then
                lastexplosion1 := true
            end if
            if lives1 >= 1 and jetalive1 = false then
                lives1 := lives1 - 1
                jetalive1 := true
            end if
        end if
        if jethealth2 <= 0 and jetalive2 = true then
            jetalive2 := false
            fork explosion2
            fork explosionsound2
            if lives2 > 0 then
                jethealth2 := 100
            elsif lives2 = 0 then
                lastexplosion2 := true
            end if
            if lives2 >= 1 and jetalive2 = false then
                lives2 := lives2 - 1
                jetalive2 := true
            end if
        end if
        if jetalive1 = false and jetalive2 = false and lives1 = 0 and lives2 = 0 then
            gameoverquestionmark := true
        end if
        exit when jetalive1 = false and jetalive2 = false and lives1 = 0 and lives2 = 0
        exit when gameoverquestionmark = true
        exit when gamewon = true
        %Player 1
        Input.KeyDown (keys)
        if keys (KEY_UP_ARROW) and jetalive1 = true then
            y := y + 10
            delay (1)
        end if
        if keys (KEY_DOWN_ARROW) and jetalive1 = true then
            y := y - 10
            delay (1)
        end if
        if keys (KEY_RIGHT_ARROW) and jetalive1 = true then
            x := x + 15
            delay (1)
        end if
        if keys (KEY_LEFT_ARROW) and jetalive1 = true then
            x := x - 15
            delay (1)
        end if
        if keys (KEY_CTRL) and jetalive1 = true then
            gun1fire := true
            fork mgun1
            fork mgun1sound
            gun1fire := false
            View.Update
            cls
            drawscreen
        end if
        %Player 2
        if keys ('w') and jetalive2 = true then
            y2 := y2 + 10
            delay (1)
        end if
        if keys ('s') and jetalive2 = true then
            y2 := y2 - 10
            delay (1)
        end if
        if keys ('d') and jetalive2 = true then
            x2 := x2 + 15
            delay (1)
        end if
        if keys ('a') and jetalive2 = true then
            x2 := x2 - 15
            delay (1)
        end if
        if keys ('f') and jetalive2 = true then
            gun2fire := true
            fork mgun2
            fork mgun2sound
            gun2fire := false
            View.Update
            cls
            drawscreen
        end if
        if y > 438 then         %Top Solidness for Player 1
            y := 437
        end if
        if y < 0 then         %Bottom Solidness for Player 1
            y := 1
        end if
        if x < 0 then         %Left Solidness for Player 1
            x := 1
        end if
        if x > 600 then         %Right Solidness for Player 1
            x := 599
        end if
        if y2 > 438 then         %Top Solidness for Player 2
            y2 := 437
        end if
        if y2 < 0 then         %Bottom Solidness for Player 2
            y2 := 1
        end if
        if x2 < 0 then         %Left Solidness for Player 2
            x2 := 1
        end if
        if x2 > 600 then         %Right Solidness for Player 2
            x2 := 599
        end if
        drawscreen
    end loop
    exit when gameoverfinal = true
    if gameoverquestionmark = true and gameoverfinal = false then
        colourback (7)
        cls
        fork gobgmusic
        Pic.Draw (earth, 250, 250, picCopy)
        Pic.Draw (GOBG, -20, -10, picCopy)
        Pic.Draw (GOBG2, 300, -10, picCopy)
        Pic.Draw (GOBG3, 620, -10, picCopy)
        Font.Draw ("Game Over", 275, 300, comicsansms, 12)
        Font.Draw ("Player 1:" + intstr (score1, 3), 10, 500, comicsansms2, 12)
        Font.Draw ("Player 2:" + intstr (score2, 3), 10, 460, comicsansms2, 12)
        View.Update
        delay (8000)
    end if
    delay (3000)
    colour (brightgreen)
    cls
    View.Update
    put "P"
    View.Update
    delay (50)
    locate (1, 2)
    put "l"
    View.Update
    delay (50)
    locate (1, 3)
    put "a"
    View.Update
    delay (50)
    locate (1, 4)
    put "y"
    View.Update
    delay (50)
    locate (1, 6)
    put "a"
    View.Update
    delay (50)
    locate (1, 7)
    put "g"
    View.Update
    delay (50)
    locate (1, 8)
    put "a"
    View.Update
    delay (50)
    locate (1, 9)
    put "i"
    View.Update
    delay (50)
    locate (1, 10)
    put "n"
    View.Update
    delay (50)
    locate (1, 11)
    put "?"
    View.Update
    delay (50)
    locate (2, 1)
    put "("
    View.Update
    delay (50)
    locate (2, 2)
    put "y"
    View.Update
    delay (50)
    locate (2, 3)
    put "/"
    View.Update
    delay (50)
    locate (2, 4)
    put "n"
    View.Update
    delay (50)
    locate (2, 5)
    put ")"
    View.Update
    get playagain
    if playagain = "N" or playagain = "n" then
        gameoverfinal := true
    end if
    exit when gameoverfinal = true
    if playagain = "Y" or playagain = "y" then
        x := 100
        y := 410
        x2 := 100
        y2 := 70
        lives1 := 3
        lives2 := 3
        gamewon := false
        gameoverquestionmark := false
        jethealth1 := 100
        jethealth2 := 100
        jetalive1 := true
        jetalive2 := true
    end if
    exit when gameoverfinal = true
end loop
cls

Help would be much appreciated. There's some extra files in the zip. Just old files we stopped using but are too lazy to delete.



TheGame.zip
 Description:

Download
 Filename:  TheGame.zip
 Filesize:  304.2 KB
 Downloaded:  340 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Tue Jun 10, 2003 5:43 pm   Post subject: (No subject)

ummm dude, no offense or anything, but no one would want to read that, u should tell us the problem instead of having us to troubleshoot
GOLDEN WEAPON




PostPosted: Tue Jun 10, 2003 5:48 pm   Post subject: (No subject)

ok.. well I think the problem is that the enemy drawer is a process and when it draws the images in the for loop, in the drawscreen, the view.updates are being executed when only some of the enemy ships are drawn, at least I think.... ? So they appear to flash, maybe.... I dunno, I'm surprised I was able to write that much and to still have it work
Tony




PostPosted: Tue Jun 10, 2003 7:47 pm   Post subject: (No subject)

if you have that much code, plz just attach the file. Makes it easier for everybody.

Now... using processes eliminates the whole damn purpose of View.Update...

The point was to draw to vertual buffer and display whole picture once done to eliminate flashing

now if you're using processes to draw parts of pictures all over the place, and view update after each part... well you're just being stupid now Confused
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Mazer




PostPosted: Wed Jun 11, 2003 7:22 am   Post subject: (No subject)

yes. or...

http://www.compsci.ca/bbs/viewtopic.php?t=1309
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  [ 5 Posts ]
Jump to:   


Style:  
Search: