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

Username:   Password: 
 RegisterRegister   
 Screen stuff
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
gilbamy




PostPosted: Mon Jun 19, 2006 8:21 pm   Post subject: Screen stuff

alright i was not really sure on what to name this though so my problem is that i need to have my game war show the players cards so i can make sure there arre no doubles but i need to have the person press H then have it open another screen and ask them to input p1 or p2 then show there cards i know i have to uses an if statement though but i tried doing something for showing my cards like
code:
if p1 then
                                          put p1
                                           end if

but that so does not work so here is my crap code and i know that i should have my cardvalue stuff in a for loop .(sorr for spelling and grammer)
code:
%Amy Gilbank
%June 1 2006
%war1.t
%a game of war
var winMain : int := Window.Open ("graphics:800;600")
var font1, font2, font3, font4, font5 : int
var Randomcard, x1, x2, y1, y2, y3, y4, x3, x4, button : int
var p1value, p2value, deck, deckvalue, decktest, cards, cardvalue, p1, checkdeck, p2 : array 1 .. 52 of int
var key1 : array char of boolean
%The mus procedure is my music for my logo.
process mus
    Music.Play ("2acfega4c4c4cfgeaeg2d4adfe2fg")
end mus
%This is my logo where the lines and squeres appear and music plays .
procedure logo
    drawfillbox (0, 600, 800, 0, 7)
    font3 := Font.New ("Allegro BT:25:")
    Font.Draw ("Sabriel", 320, 260, font3, 0)
    fork mus
    delay (500)
    drawbox (300, 480, 360, 420, 0)
    delay (500)
    drawline (300, 480, 360, 340, 0)
    delay (500)
    drawline (300, 420, 360, 280, 0)
    delay (500)
    drawline (360, 420, 420, 280, 0)
    delay (500)
    drawline (360, 480, 420, 340, 0)
    delay (500)
    drawbox (360, 340, 420, 280, 0)
    delay (500)
    drawline (420, 240, 340, 140, 0)
    delay (500)
    drawline (420, 240, 540, 240, 0)
    delay (500)
    drawline (540, 240, 500, 140, 0)
    delay (500)
    drawline (340, 140, 500, 140, 0)
    delay (500)
    drawline (420, 240, 340, 140, 0)
    delay (500)
    drawline (500, 140, 420, 280, 0)
    delay (500)
    drawline (420, 240, 420, 280, 0)
    delay (500)
    drawline (340, 140, 420, 280, 0)
    delay (500)
    drawline (540, 240, 420, 280, 0)
    delay (500)
end logo
procedure intro
    font4 := Font.New ("Allegro BT:50:")
    font5 := Font.New ("Allegro BT:25:")
    x3 := 360
    y3 := 455
    x4 := 475
    y4 := 500
    drawfillbox (0, 600, 800, 0, 19)
    drawfillbox (360, 455, 475, 500, 105)
    drawfillbox (520, 420, 320, 375, 105)
    drawfillbox (350, 330, 480, 295, 105)
    drawfillbox (365, 225, 455, 260, 105)
    Font.Draw ("War!", 340, 530, font4, 56)
    Font.Draw ("Play", 385, 460, font5, 56)
    Font.Draw ("Instructions", 335, 380, font5, 56)
    Font.Draw ("Options", 365, 300, font5, 56)
    Font.Draw ("Quit", 380, 230, font5, 56)
    %This  is where if i  click on the play button it will bring me to my spot to decide who goes first.
    loop
        Mouse.Where (x3, y3, button)
        if (x3 > x4 and x3 < x4) and (y3 > y4 and y3 < y4) then
            button := 1
        end if
        if button = 1 then
            locatexy (maxx div 4, maxy div 2)
            delay (500)
            cls
        end if
    end loop

end intro
%This code goes between the number 1 and 2 which means 1 is p1 and 2 is p2 the last number that is chossen is who goes first its random .
procedure wgf
    var Randnum : int
    for i : 1 .. 7
        Randnum := Rand.Int (1, 2)
        put Randnum
    end for
    if Randnum = 2 then
        put "Player two goes first"
    elsif Randnum = 1 then
        put "Player one goes first"
    end if
end wgf
procedure war
    %my war layout like my background boxs and my fonts
    drawfillbox (0, 600, 800, 0, 199)
    %Battle area
    drawfillbox (20, 100, 95, 200, 78)
    drawfillbox (120, 100, 195, 200, 78)
    drawfillbox (220, 100, 295, 200, 78)
    drawfillbox (320, 100, 395, 200, 78)
    drawfillbox (420, 100, 495, 200, 78)
    drawfillbox (520, 100, 595, 200, 78)
    drawfillbox (620, 100, 695, 200, 78)
    drawfillbox (720, 100, 795, 200, 78)
    %Deck and cards spot
    drawfillbox (200, 400, 275, 500, 79)
    drawfillbox (500, 400, 575, 500, 80)
    drawfillbox (300, 400, 375, 500, 0)
    drawfillbox (400, 400, 475, 500, 0)
    %Scoreboard and card number spots
    drawfillbox (320, 360, 360, 380, 0)
    drawfillbox (420, 360, 460, 380, 0)
    %Fonts
    font1 := Font.New ("Vineta BT:45: bold,underline")
    Font.Draw ("WAR!", 260, 550, font1, red)
    font2 := Font.New ("New Times Roman :11:")
    Font.Draw ("Player 1", 300, 310, font2, 27)
    Font.Draw ("Player 2", 410, 310, font2, 27)
    Font.Draw ("Deck", 220, 510, font2, 27)
    Font.Draw ("Deck", 520, 510, font2, 27)
    %Cards
    %Inserting my cards into my program
    cards (1) := Pic.FileNew ("10C.jpg")
    cards (2) := Pic.FileNew ("10D.jpg")
    cards (3) := Pic.FileNew ("10H.jpg")
    cards (4) := Pic.FileNew ("10S.jpg")
    cards (5) := Pic.FileNew ("2C.jpg")
    cards (6) := Pic.FileNew ("2D.jpg")
    cards (7) := Pic.FileNew ("2H.jpg")
    cards (8) := Pic.FileNew ("2S.jpg")
    cards (9) := Pic.FileNew ("3C.jpg")
    cards (10) := Pic.FileNew ("3D.jpg")
    cards (11) := Pic.FileNew ("3H.jpg")
    cards (12) := Pic.FileNew ("3S.jpg")
    cards (13) := Pic.FileNew ("4C.jpg")
    cards (14) := Pic.FileNew ("4D.jpg")
    cards (15) := Pic.FileNew ("4H.jpg")
    cards (16) := Pic.FileNew ("4S.jpg")
    cards (17) := Pic.FileNew ("5C.jpg")
    cards (18) := Pic.FileNew ("5D.jpg")
    cards (19) := Pic.FileNew ("5H.jpg")
    cards (20) := Pic.FileNew ("5S.jpg")
    cards (21) := Pic.FileNew ("6C.jpg")
    cards (22) := Pic.FileNew ("6D.jpg")
    cards (23) := Pic.FileNew ("6H.jpg")
    cards (24) := Pic.FileNew ("6S.jpg")
    cards (25) := Pic.FileNew ("7C.jpg")
    cards (26) := Pic.FileNew ("7D.jpg")
    cards (27) := Pic.FileNew ("7H.jpg")
    cards (28) := Pic.FileNew ("7S.jpg")
    cards (29) := Pic.FileNew ("8C.jpg")
    cards (30) := Pic.FileNew ("8D.jpg")
    cards (31) := Pic.FileNew ("8H.jpg")
    cards (32) := Pic.FileNew ("8S.jpg")
    cards (33) := Pic.FileNew ("9C.jpg")
    cards (34) := Pic.FileNew ("9D.jpg")
    cards (35) := Pic.FileNew ("9H.jpg")
    cards (36) := Pic.FileNew ("9S.jpg")
    cards (37) := Pic.FileNew ("QC.jpg")
    cards (38) := Pic.FileNew ("QD.jpg")
    cards (39) := Pic.FileNew ("QH.jpg")
    cards (40) := Pic.FileNew ("QS.jpg")
    cards (41) := Pic.FileNew ("AC.jpg")
    cards (42) := Pic.FileNew ("AD.jpg")
    cards (43) := Pic.FileNew ("AH.jpg")
    cards (44) := Pic.FileNew ("AS.jpg")
    cards (45) := Pic.FileNew ("JC.jpg")
    cards (46) := Pic.FileNew ("JD.jpg")
    cards (47) := Pic.FileNew ("JH.jpg")
    cards (48) := Pic.FileNew ("JS.jpg")
    cards (49) := Pic.FileNew ("KC.jpg")
    cards (50) := Pic.FileNew ("KD.jpg")
    cards (51) := Pic.FileNew ("KH.jpg")
    cards (52) := Pic.FileNew ("KS.jpg")
    %Dealing the cards to P1 and P2
    x1 := 300
    y1 := 400
    x2 := 400
    y2 := 400

    for i : 1 .. 52
        checkdeck (i) := 1
    end for

    for i : 1 .. 26
        loop
            Randomcard := Rand.Int (1, 52)
            exit when checkdeck (Randomcard) = 1
        end loop
        checkdeck (Randomcard) := 0
        p1 (i) := cards (Randomcard)
    end for

    for i : 1 .. 26
        loop
            Randomcard := Rand.Int (1, 52)
            exit when checkdeck (Randomcard) = 1
        end loop
        checkdeck (Randomcard) := 1
        p2 (i) := cards (Randomcard)
    end for
    for i : 1 .. 26
        Pic.Draw (p1 (i), x1, y1, 0)
        Pic.Draw (p2 (i), x2, y2, 0)
    end for
    put "Please hit H if wanting to see players hands:.."
    Input.KeyDown (key1)
    if key1 ("H") then
        x1 := x1 + 5
        end if
        loop
            var winMain : int := Window.Open ("graphics:800;600")
            put "Please enter P1 or P2 to view hands :.."
    end loop
    %card values
    cardvalue (1) := 10
    cardvalue (2) := 10
    cardvalue (3) := 10
    cardvalue (4) := 10
    cardvalue (5) := 2
    cardvalue (6) := 2
    cardvalue (7) := 2
    cardvalue (8) := 2
    cardvalue (9) := 3
    cardvalue (10) := 3
    cardvalue (11) := 3
    cardvalue (12) := 3
    cardvalue (13) := 4
    cardvalue (14) := 4
    cardvalue (15) := 4
    cardvalue (16) := 4
    cardvalue (17) := 5
    cardvalue (18) := 5
    cardvalue (19) := 5
    cardvalue (20) := 5
    cardvalue (21) := 6
    cardvalue (22) := 6
    cardvalue (23) := 6
    cardvalue (24) := 6
    cardvalue (25) := 7
    cardvalue (26) := 7
    cardvalue (27) := 7
    cardvalue (28) := 7
    cardvalue (29) := 8
    cardvalue (30) := 8
    cardvalue (31) := 8
    cardvalue (32) := 8
    cardvalue (33) := 9
    cardvalue (34) := 9
    cardvalue (35) := 9
    cardvalue (36) := 9
    cardvalue (37) := 12
    cardvalue (38) := 12
    cardvalue (39) := 12
    cardvalue (40) := 12
    cardvalue (41) := 14
    cardvalue (42) := 14
    cardvalue (43) := 14
    cardvalue (44) := 14
    cardvalue (45) := 11
    cardvalue (46) := 11
    cardvalue (47) := 11
    cardvalue (48) := 11
    cardvalue (49) := 13
    cardvalue (50) := 13
    cardvalue (51) := 13
    cardvalue (52) := 13
end war
logo
intro
war
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: