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

Username:   Password: 
 RegisterRegister   
 Game - Pooyan from class project
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
RedRogueXIII




PostPosted: Sat Nov 05, 2005 11:11 pm   Post subject: Game - Pooyan from class project

code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
View.Set ("graphics:800,600")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Music Files/ Not Implemented Yet
process hit
    Music.Play ("c")
end hit

process background
    loop
        Music.PlayFile ("disclaimer.mid")
    end loop

end background

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%The Title Procedure - Draws the title screen and waits for the user to click before proceeding
proc title (font, picid : int)

    var mx, my, mb : int
    drawfillbox (0, 0, maxx, maxy, black)
    %Puts In a Picture
    %Pic.Draw (picid, (maxx div 2) - 200, maxy - 200, picMerge)
    %%%%%%%%%%%%%%%%%%
    Draw.Text ("PooYan", (maxx div 2) - 150, maxy div 2, font, red)
    delay (1000)
    loop
        mousewhere (mx, my, mb)
        if mb = 1 then
            drawfillbox (0, 0, maxx, maxy, white)
            exit
        end if
    end loop
end title

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Choose Difficulties - Affects Arrow Speed, Wolf Fall Speed - Needs to affect amount of wolves on screen at a time.
proc difficulty (var input : int)
    locate (10, maxrow div 2)
    put "Choose Your Difficulty."
    put "1- Easy Mode"
    put "2- Normal Mode"
    put "3- Hard Mode"
    put "4- Hyper Mode"
    loop
        locate (15, maxrow div 2)
        get input
        if input <= 4 then
            exit
        end if
    end loop
    drawfillbox (0, 0, maxx, maxy, white)

end difficulty

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Gives a countdown so that the user can get ready for HYPER MODE DIFFICULTY

proc rdy4hype (font2 : int)
    drawfillbox (0, 0, maxx, maxy, black)
    Draw.Text ("!! HYPER MODE !!", (maxx div 2) - 200, (maxy div 2), font2, yellow)
    delay (1000)
    drawfillbox (0, 0, maxx, maxy, black)
    Draw.Text ("3", (maxx div 2), (maxy div 2), font2, yellow)
    delay (1000)
    drawfillbox (0, 0, maxx, maxy, black)
    Draw.Text ("2", (maxx div 2), (maxy div 2), font2, yellow)
    delay (1000)
    drawfillbox (0, 0, maxx, maxy, black)
    Draw.Text ("1", (maxx div 2), (maxy div 2), font2, yellow)
    delay (1000)
    drawfillbox (0, 0, maxx, maxy, black)
    Draw.Text ("GO!", (maxx div 2) - 50, (maxy div 2), font2, yellow)
    delay (1000)
    drawfillbox (0, 0, maxx, maxy, white)
end rdy4hype

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Moves the character - Restricts movement so that the characther can't move farther than the background(yet to be implemented, needs a sprite.)
%(Try Keyboard Input?)

proc moveguy (my : int)
    % x-var not necessary because x doesnt change
    if my <= maxy - 140 and my >= 60 then
        drawfillbox (maxx - 120, my + 21, maxx - 80, maxy + 20, white)
        drawfillbox (maxx - 120, my - 21, maxx - 80, -20, white)
        drawfillbox (maxx - 120, my - 20, maxx - 80, my + 20, blue)
    end if

end moveguy

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Shoots projectile - Speed adjusted accordingly to difficulties, needs a sprite. (try getting another arrow after 1st has passed 3/4 of screen?)
%(Try Keyboard Input?)
proc shootarrow (my, mb : int, var arrowx, arrowy : int, var arrowShotFlag : string, var deadWolf : int, var currentWolfCount : int, input : int)
    %changes according to dificulty
    var inputvar : int := 10
    if input = 1 then
        inputvar := 10
    elsif input = 2 then
        inputvar := 7
    elsif input = 3 then
        inputvar := 7
    elsif input = 4 then
        inputvar := 20
    end if


    if currentWolfCount not= deadWolf then
        arrowShotFlag := "no"
        arrowx := maxx - 120
    end if

    if mb = 1 and arrowShotFlag = "no" then %%Flag makes sure only one arrow at a time
        arrowy := my
        arrowShotFlag := "yes"

    end if
    if arrowx < -100 then
        arrowShotFlag := "no"
        arrowx := maxx - 120
    end if
    if arrowShotFlag = "yes" and my <= maxy - 140 and my >= 60 then
        % moves arrow accross the screen from right to left
        drawfilloval (arrowx, arrowy, 5, 5, white)
        arrowx -= inputvar
        drawfilloval (arrowx, arrowy, 5, 5, red)
    end if

end shootarrow

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Drops the wolf, speed is adjusted to difficulties, sets wolves up at top screen to be dropped,(Need to fix: Get wolves to set up without delaying program.)
proc dropwolf (var wx, wy, mis : int, var wolffallflag, oneshotperwolf : boolean, var deadWolf : int, var currentWolfCount : int, wolfsize, my, input : int, var bulletshotflag : boolean, wolfbulletx,
        wolfbullety : int)
    %changes according to dificulty
    var inputvar : int := 10
    if input = 1 then
        inputvar := 1
    elsif input = 2 then
        inputvar := 2
    elsif input = 3 then
        inputvar := 3
    elsif input = 4 then
        inputvar := 5
    end if

    var rwx : int
    if currentWolfCount not= deadWolf then
        wolffallflag := false
        currentWolfCount := deadWolf

    end if
    %check to see if one died

    if wolffallflag = false then %resets wolf
        drawfilloval (wolfbulletx, wolfbullety, 5 + 1, 5 + 1, white) % THis will destroy wolf's attack if wolf is destroyed
        drawfilloval (wx, wy, wolfsize + 1, wolfsize + 1, white)
        randint (wx, 40, maxx - 200)
        wolffallflag := true
        bulletshotflag := false
        oneshotperwolf := true
        wy := maxy - 100
        %sets wolf up to be dropped
        rwx := wx

        for rx : 0 .. rwx
            drawfilloval (rx, wy, wolfsize + 1, wolfsize + 1, white)
            drawfilloval (rx, wy, wolfsize, wolfsize, green)

        end for
    end if

    if wolffallflag = true and wy > -100 then
        wy -= inputvar %drops wolf

        drawfilloval (wx, wy + inputvar, wolfsize + 1, wolfsize + 1, white)
        drawfilloval (wx, wy, wolfsize, wolfsize, green)

        delay (5)
    elsif wolffallflag = true then
        wolffallflag := false
    end if
end dropwolf

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Wolves set uo for round 2 , speed is adjusted to difficulties, wolves fire more than one shot in round two,(Need to fix: Get wolves to set up without delaying program.)
proc wolfup (var wx, wy, mis : int, var wolfupflag, oneshotperwolf : boolean, var deadWolf : int, var currentWolfCount : int, wolfsize, my, input : int, var bulletshotflag : boolean, wolfbulletx,
        wolfbullety : int)
    %changes according to dificulty
    var topwolf : boolean := false
    var inputvar : int := 10
    if input = 1 then
        inputvar := 1
    elsif input = 2 then
        inputvar := 2
    elsif input = 3 then
        inputvar := 3
    elsif input = 4 then
        inputvar := 5
    end if

    var rwx : int

    if currentWolfCount not= deadWolf then
        wolfupflag := false
        currentWolfCount := deadWolf
    end if %check to see if one died


    if wolfupflag = false then %resets wolf
        drawfilloval (wolfbulletx, wolfbullety, 5 + 1, 5 + 1, white) % THis will destroy wolf's attack if wolf is destroyed
        drawfilloval (wx, wy + inputvar, wolfsize + 1, wolfsize + 1, white)

        randint (wx, 40, maxx - 200)
        wolfupflag := true
        bulletshotflag := false
        oneshotperwolf := true
        wy := 30
        %sets wolf up to be dropped
        rwx := wx

        for rx : 0 .. rwx
            drawfilloval (rx, 30, wolfsize + inputvar, wolfsize + inputvar, white)
            drawfilloval (rx, wy, wolfsize, wolfsize, red)
            delay (2)

        end for
    end if





    if wolfupflag = true and wy <= maxy - 120 then
        wy += inputvar
        drawfilloval (wx, (wy - (wolfsize div 2)) + 1, wolfsize, wolfsize, white)
        drawfilloval (wx, wy, wolfsize, wolfsize, red)
        locate (4, 1)
        put "Under the top."
        delay (5)
        if wolfupflag = true and wy > maxy - 120 then
            drawfilloval (wx, wy, wolfsize + 1, wolfsize + 1, white)
            locate (4, 1)
            put "Over the top."
        end if


        if oneshotperwolf = false then
            oneshotperwolf := true
        end if


    elsif wolfupflag = true then
        wolfupflag := false


    end if
end wolfup

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Handles when a wolf reaches the top - right now a wolf at the top takes away 1 life
proc wolftop (wx, wolfsize : int, var wy : int, deadWolf : int, var lifecount : int, var oneshotperwolf, wolfupflag : boolean)

    if wy > (maxy - 120) then
        oneshotperwolf := true
        drawfilloval (wx, wy + 10, wolfsize, wolfsize, white)
        lifecount := lifecount - 1
        wolfupflag := false
        wy := 0

    end if
end wolftop



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Wolf Attack Code - Under Construction - Should shoot according to where my is, gets more accurate/faster the higher the difficulties
%(Try making the projectile attackable for points.) TRYING TO MAKE PARABOLAS>>!!!! NOT WORKING - TO COMPLEX
proc wolfattack (wx, wy, my, mis : int, var lifecount : int, wolfFallFlag : boolean, var oneshotperwolf : boolean)
    var px, py : int
    if wolfFallFlag = true and oneshotperwolf = false and wy <= my then
        px := wx
        py := wy
        drawline (px, py, maxx - 120, mis, red)
        oneshotperwolf := true
    end if
    %drawfillbox (0, 0, maxx - 120, maxy - 100, white)
end wolfattack

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Wolf Attack Code - Straight Shooter Version! ( THIS WORKS ) bullets should be attackable
proc wolfshoot (wx, wy, my, input : int, var wolfbulletx, wolfbullety : int, wolffallflag : boolean, var bulletshotflag, oneshotperwolf : boolean)
    var shooton : boolean := bulletshotflag
    % This part changes Projectile Speed According To Difficulty
    var inputvar : int := 0
    if input = 1 then
        inputvar := 2
    elsif input = 2 then
        inputvar := 4
    elsif input = 3 then
        inputvar := 5
    elsif input = 4 then
        inputvar := 10
    end if

    if wolffallflag = false then
        drawfilloval (wolfbulletx, wolfbullety, 5 + 1, 5 + 1, white)
    end if

    if wolffallflag = true and bulletshotflag = false and wy <= my + 20 and wy >= my - 20 then
        wolfbullety := wy
        wolfbulletx := wx
        if oneshotperwolf = true then
            bulletshotflag := true
        end if
    end if

    if shooton = true and oneshotperwolf = true then
        wolfbulletx += inputvar
        drawfilloval (wolfbulletx, wolfbullety, 5 + inputvar, 5 + inputvar, white)
        drawfilloval (wolfbulletx, wolfbullety, 5, 5, yellow)
    end if

    if wolfbulletx >= maxx then
        drawfilloval (wolfbulletx, wolfbullety, 5 + 1, 5 + 1, white)
        bulletshotflag := false
        oneshotperwolf := false
    end if

    if wy <= 30 and wolfbulletx >= maxx then
        oneshotperwolf := true
    end if

end wolfshoot
%< = less than, > = greater than

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Wolf Projectile Collision Code - if shot connects to player then player loses one life
proc projcoll (my : int, var wolfbulletx, wolfbullety : int, var lifecount : int, var bulletshotflag, oneshotperwolf : boolean)

    if wolfbulletx >= maxx - 120 and wolfbulletx <= maxx - 80 and wolfbullety <= my + 20 and wolfbullety >= my - 20 then
        drawfilloval (wolfbulletx, wolfbullety, 10, 10, white)
        wolfbulletx := 0
        wolfbullety := 0
        oneshotperwolf := false
        bulletshotflag := false
        lifecount := lifecount - 1
    end if

end projcoll

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Handles Collision for wolf/player projectle - Resets arrow if hit, blanks out the arrow shot.
proc collisionDetection (wx, wy : int, var arrowx, arrowy : int, var arrowShotFlag : string, var deadWolf : int, input : int)
    var inputvar : int := 10
    if input = 1 then
        inputvar := 1
    elsif input = 2 then
        inputvar := 2
    elsif input = 3 then
        inputvar := 3
    elsif input = 4 then
        inputvar := 5
    end if

    if arrowx - 5 <= wx + 40 and arrowy - 5 >= wy - 40 and arrowx - 5 >= wx - 40 and arrowy + 5 <= wy + 40 then
        %fork hit %Plays Chime Upon Hit
        arrowShotFlag := "no"
        drawfilloval (wx, wy, 30 + inputvar, 30 + inputvar, white)
        drawfilloval (arrowx, arrowy, 10 + inputvar, 10 + inputvar, white)
        arrowx := maxx - 120
        deadWolf := deadWolf + 1
    end if
end collisionDetection

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Handles when a wolf reaches the bottom - right now a wolf at the bottom takes away 1 life
%(fills up slots to 4 then lose a life for any extra wolf that gets down.)
proc wolfbottom (wx, wolfsize : int, var wy : int, deadWolf : int, var lifecount : int, var oneshotperwolf : boolean, slot4 : boolean)
    if wy <= 30 and slot4 = true then
        oneshotperwolf := true
        drawfilloval (wx, wy, wolfsize, wolfsize, white)
        wy := maxy - 100
        lifecount := lifecount - 1
    elsif wy <= 30 then
        oneshotperwolf := true
        drawfilloval (wx, wy, wolfsize, wolfsize, white)
        wy := maxy - 100
    end if
end wolfbottom

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Turns on the slot wolf switches (needs to be adjusted so that it counts at higher difficulties.)
proc wolfhit (wx, wy : int, var slot1, slot2, slot3, slot4 : boolean, input : int)
    %Puts a wolf in a slot

    if wy <= 30 and slot1 = false then
        slot1 := true
    elsif wy <= 30 and slot1 = true and slot2 = false then
        slot2 := true
    elsif wy <= 30 and slot2 = true and slot3 = false then
        slot3 := true
    elsif wy <= 30 and slot3 = true and slot4 = false then
        slot4 := true
    end if
end wolfhit

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Puts Wolves into the four slots - Needs to go along with random attacks from slot positions and take away lives if they are all full.
proc slotwolf (slot1, slot2, slot3, slot4 : boolean, wolfsize : int)
    var range : int := (maxy - 80) - (0 + 80)


    drawbox (maxx - 40, 40, maxx - 30, range, black)

    if slot1 = true then
        drawfilloval (maxx - 40, (range - (range div 2)) div 2, wolfsize, wolfsize, green)
    end if
    if slot2 = true then
        drawfilloval (maxx - 40, range div 2, wolfsize, wolfsize, green)
    end if
    if slot3 = true then
        drawfilloval (maxx - 40, (range + (range div 2)) div 2, wolfsize, wolfsize, green)
    end if
    if slot4 = true then
        drawfilloval (maxx - 40, range, wolfsize, wolfsize, green)

    end if
end slotwolf

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Timed attacks from the wolves inside the four slot (Yet to be finished.)
process timer (wslot1atk, wslot2atk, wslot3atk, wslot4atk : boolean)
    delay (1000)
end timer

proc slotwolfattack (my : int, slot1, slot2, slot3, slot4 : boolean, var wslot1atk, wslot2atk, wslot3atk, wslot4atk : boolean)

end slotwolfattack

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Decides if Game was sucessful or not - allows player to choose whether or not it they want to play again.
proc endgame (lifecount : int, var playagain : boolean, var roundtwo : boolean)
    var decision : string

    if lifecount = 0 then
        locate (10, 5)
        put "GAME OVER"
    elsif lifecount >= 1 then

        locate (10, 5)
        put "Congratulations You Win."
    end if


    locate (16, 5)
    put "Play Again? [Y/N]"
    get decision

    if decision = "y" or decision = "Y" then
        playagain := true
        roundtwo := false
        drawfillbox (0, 0, maxx, maxy, white)
    elsif decision = "n" or decision = "N" then
        playagain := false
        roundtwo := false

    end if

end endgame

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Basic Heads Up Display that shows the points calculated according to difficulties,and number of lives left.
proc headsup (deadWolf, lifecount, input : int, var highscore : int, roundtwo : boolean, var shs : int, wolveslefttonext : int)
    %Multiplies Score According To Difficulties
    var inputvar : int
    if input = 1 and roundtwo = false then
        inputvar := 100
    elsif input = 2 and roundtwo = false then
        inputvar := 200
    elsif input = 3 and roundtwo = false then
        inputvar := 300
    elsif input = 4 and roundtwo = false then
        inputvar := 400
    end if
    if input = 1 and roundtwo = true then
        inputvar := 200
    elsif input = 2 and roundtwo = true then
        inputvar := 300
    elsif input = 3 and roundtwo = true then
        inputvar := 500
    elsif input = 4 and roundtwo = true then
        inputvar := 1000
    end if
    %Displays Score/Lives Left
    locate (1, 2)
    put deadWolf * inputvar, " points."..
    highscore := deadWolf * inputvar
    locate (2, 1)
    put wolveslefttonext - deadWolf, " wolves left"..

    locate (1, 18)
    put lifecount, " lives left."..
    if roundtwo = false then
        locate (1, 32)
        put " ROUND ONE"..
    elsif roundtwo = true then
        locate (1, 32)
        put " ROUND TWO"..
    end if

end headsup


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Makes a Basic High Score List, shows points, difficulty level and lives left, calculating a culmative final score accordingly.
proc scores (input, highscore, lifecount : int, var rto : boolean, shs : int)
    var inputvar : string
    var mx, my, mb : int
    var bylives : int
    if input = 1 then
        inputvar := "  - Easy"
    elsif input = 2 then
        inputvar := "  - Normal"
    elsif input = 3 then
        inputvar := "  - Hard"
    elsif input = 4 then
        inputvar := "  - Hyper"
    end if

    if lifecount = 0 then
        bylives := 1
    else
        bylives := lifecount
    end if

    drawfillbox (0, 0, maxx, maxy, white)

    locate (2, 30)
    put "Highscores"
    if rto = false then
        put shs, inputvar, " LIVES ", lifecount, " TOTAL POINTS ", (shs * bylives), " HIGHEST LEVEL REACHED ::  ROUND ONE"
    elsif rto = true then
        put shs, inputvar, " LIVES ", lifecount, " TOTAL POINTS ", (shs * bylives), " HIGHEST LEVEL REACHED ::  ROUND TWO"
    end if
    locate (maxrow, 30)
    put "Click To Continue"

    loop
        mousewhere (mx, my, mb)
        if mb = 1 then
            exit
        end if
    end loop

end scores

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Gives a countdown so that the user can get ready for round two

proc countdowner (roundtwo : boolean, font2 : int)
    if roundtwo = true then
        drawfillbox (0, 0, maxx, maxy, black)
        Draw.Text ("ROUND TWO- GET READY", (maxx div 2) - 200, (maxy div 2), font2, white)
        delay (1000)
        drawfillbox (0, 0, maxx, maxy, black)
        Draw.Text ("3", (maxx div 2), (maxy div 2), font2, white)
        delay (1000)
        drawfillbox (0, 0, maxx, maxy, black)
        Draw.Text ("2", (maxx div 2), (maxy div 2), font2, white)
        delay (1000)
        drawfillbox (0, 0, maxx, maxy, black)
        Draw.Text ("1", (maxx div 2), (maxy div 2), font2, white)
        delay (1000)
        drawfillbox (0, 0, maxx, maxy, black)
        Draw.Text ("GO!", (maxx div 2) - 50, (maxy div 2), font2, white)
        delay (1000)
        drawfillbox (0, 0, maxx, maxy, white)
    end if
end countdowner

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Shows a Health Bar for remaining lives/Hit Points
proc lifebar (lifecount : int)
    var numcount : int := 10
    var currentcount : int
    var c : int := 0
    drawfillbox (maxx - 310, maxy - 20, maxx - 210, maxy - 10, red)
    drawbox ((maxx - 310) - 1, (maxy - 20) - 1, (maxx - 210) + 1, (maxy - 10) + 1, black)
    if lifecount = 9 then
        drawfillbox (maxx - 220, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 8 then
        drawfillbox (maxx - 230, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 7 then
        drawfillbox (maxx - 240, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 6 then
        drawfillbox (maxx - 250, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 5 then
        drawfillbox (maxx - 260, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 4 then
        drawfillbox (maxx - 270, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 3 then
        drawfillbox (maxx - 280, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 2 then
        drawfillbox (maxx - 290, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 1 then
        drawfillbox (maxx - 300, maxy - 20, maxx - 210, maxy - 10, c)
    elsif lifecount = 0 then
        drawfillbox (maxx - 310, maxy - 20, maxx - 210, maxy - 10, c)
    end if
end lifebar


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Mainline%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Global Variables List
var highscore, shs : int := 0
var picid : int
var font, font2 : int
var input : int := 1
var mx, my, mb : int
var arrowx : int := maxx - 120
var arrowy : int := 0
var arrowShotFlag : string := "no"
var wx, wy : int := 0
var wolfFallFlag : boolean := false
var wolfupflag : boolean := false
var deadWolf : int := 0
var currentWolfCount : int := 0
var lifecount : int := 10
var wslot1atk, wslot2atk, wslot3atk, wslot4atk := false
var slot1, slot2, slot3, slot4 : boolean := false
var wolfsize : int := 30
var playagain : boolean := false
var mis : int := 0
var oneshotperwolf : boolean := false
var bulletshotflag : boolean := false
var wolfbulletx, wolfbullety : int := 0
var roundtwo, rto : boolean := false
var hyperwarning : boolean := false
var wolveslefttonext : int := 0
%%%%%%%%%%%%%%%%%%%%%%|\/|!(|-|@3|%%%%%%(3((3|\|03T%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Declaration of some Global Variables
picid := Pic.FileNew ("narutologo.bmp")
font := Font.New ("Verdana:70")
font2 := Font.New ("impact:40")

% BACKGROUND MUSIC!!!!!

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main Loop of the Game
loop
    title (font, picid)
    loop     %Difficulty Loop/End Game Loop
        playagain := false
        hyperwarning := false
        difficulty (input)

        loop     % Round One +Round Two Loop
            if roundtwo = false then
                wolveslefttonext := 5
                loop     % Round One Loop
                    if input = 4 and hyperwarning = false then
                        hyperwarning := true
                        rdy4hype (font2)
                    end if                 
                    mousewhere (mx, my, mb)
                    moveguy (my)
                    shootarrow (my, mb, arrowx, arrowy, arrowShotFlag, deadWolf, currentWolfCount, input)
                    dropwolf (wx, wy, mis, wolfFallFlag, oneshotperwolf, deadWolf, currentWolfCount, wolfsize, my, input, bulletshotflag, wolfbulletx, wolfbullety)
                    wolfshoot (wx, wy, my, input, wolfbulletx, wolfbullety, wolfFallFlag, bulletshotflag, oneshotperwolf)
                    projcoll (my, wolfbulletx, wolfbullety, lifecount, bulletshotflag, oneshotperwolf)
                    %wolfattack (wx, wy, my, mis, lifecount, wolfFallFlag, oneshotperwolf)
                    collisionDetection (wx, wy, arrowx, arrowy, arrowShotFlag, deadWolf, input)
                    wolfhit (wx, wy, slot1, slot2, slot3, slot4, input)
                    wolfbottom (wx, wolfsize, wy, deadWolf, lifecount, oneshotperwolf, slot4)
                    slotwolf (slot1, slot2, slot3, slot4, wolfsize)
                    %slotwolfattack (my, slot1, slot2, slot3, slot4, wslot1atk,wslot2atk,wslot3atk,wslot4atk)
                    lifebar (lifecount)
                    headsup (deadWolf, lifecount, input, highscore, roundtwo, shs, wolveslefttonext)
                    if deadWolf = wolveslefttonext then % Ends Round One with 35 dead wolves
                        roundtwo := true
                        if roundtwo = true then
                            shs := shs + highscore
                        end if
                        drawfillbox (0, 0, maxx, maxy, white)
                        exit
                    end if
                    if lifecount = 0 then
                        shs := shs + highscore
                        exit
                    end if

                end loop     %End Round One

            end if

            exit when lifecount = 0
            headsup (deadWolf, lifecount, input, highscore, roundtwo, shs, wolveslefttonext)

            if roundtwo = true and lifecount >= 0 then
                deadWolf := 0
                wolveslefttonext := 10

                countdowner (roundtwo, font2)     %COUNTDOWN PWNAGE

                %ROuND TWO CODE GoEs HeRe
                loop
                    rto := true
                    headsup (deadWolf, lifecount, input, highscore, roundtwo, shs, wolveslefttonext)
                    mousewhere (mx, my, mb)
                    moveguy (my)
                    shootarrow (my, mb, arrowx, arrowy, arrowShotFlag, deadWolf, currentWolfCount, input)
                    wolfup (wx, wy, mis, wolfupflag, oneshotperwolf, deadWolf, currentWolfCount, wolfsize, my, input, bulletshotflag, wolfbulletx, wolfbullety)
                    wolftop (wx, wolfsize, wy, deadWolf, lifecount, oneshotperwolf, wolfupflag)
                    collisionDetection (wx, wy, arrowx, arrowy, arrowShotFlag, deadWolf, input)
                    wolfshoot (wx, wy, my, input, wolfbulletx, wolfbullety, wolfupflag, bulletshotflag, oneshotperwolf)
                    projcoll (my, wolfbulletx, wolfbullety, lifecount, bulletshotflag, oneshotperwolf)
                    lifebar (lifecount)
                    if deadWolf >= wolveslefttonext then % Ends Round One with 70 dead wolves
                        shs := shs + highscore
                        roundtwo := false
                        exit
                    end if
                    if lifecount = 0 then
                        shs := shs + highscore
                        roundtwo := false
                        exit
                    end if

                end loop     % END ROUND TWO
            end if

            if roundtwo = false and highscore >= 0 then
                exit
            end if

            exit when lifecount = 0
            headsup (deadWolf, lifecount, input, highscore, roundtwo, shs, wolveslefttonext)


        end loop

        drawfillbox (0, 0, maxx, maxy, white)
        headsup (deadWolf, lifecount, input, highscore, roundtwo, shs, wolveslefttonext)
        endgame (lifecount, playagain, roundtwo)

        if playagain = false then
            roundtwo := false
            exit
        elsif playagain = true then
            wolveslefttonext := 0
            roundtwo := false
            rto := false
            shs := 0
            deadWolf := 0
            lifecount := 10
            slot1 := false
            slot2 := false
            slot3 := false
            slot4 := false
        end if

    end loop
    scores (input, highscore, lifecount, rto, shs)
    wolveslefttonext := 0
    deadWolf := 0
    lifecount := 10
    shs := 0
    roundtwo := false
    slot1 := false
    slot2 := false
    slot3 := false
    slot4 := false
    rto := false
end loop
%Collision takes too long


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%PROBLEMS%

%NO GFX
%Delay while loading a wolf stops program
%Randomizing Slot wolves attacks
%Wolf Attacks using parabolas

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



umm so yeah.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: