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

Username:   Password: 
 RegisterRegister   
 pacman
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
kit-kat-kid




PostPosted: Fri May 07, 2004 12:26 pm   Post subject: pacman

code:
setscreen ("graphics:svga4")
setscreen ("noecho")
setscreen ("graphics:800;600")
var keypress : string (1) := " "
var x : int := 30
var y : int := 30
var a : int := 45
var counter : int := 0
var finish : int := 0



proc Rpac1
    drawfillarc (x, y, 15, 15, 40, 320, 14)
    drawfillarc (x, y, 15, 15, 320, 40, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 40, 320, 0)
end Rpac1

proc Rpac2
    drawfillarc (x, y, 15, 15, 25, 345, 14)
    drawfillarc (x, y, 15, 15, 345, 25, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 25, 345, 0)
end Rpac2

proc Rpac3
    drawfillarc (x, y, 15, 15, 10, 350, 14)
    drawfillarc (x, y, 15, 15, 350, 10, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 10, 350, 0)
end Rpac3

proc Lpac1
    drawfillarc (x, y, 15, 15, 220, 140, 14)
    drawfillarc (x, y, 15, 15, 140, 220, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 220, 140, 0)
end Lpac1

proc Lpac2
    drawfillarc (x, y, 15, 15, 195, 165, 14)
    drawfillarc (x, y, 15, 15, 165, 195, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 195, 165, 0)
end Lpac2

proc Lpac3
    drawfillarc (x, y, 15, 15, 190, 170, 14)
    drawfillarc (x, y, 15, 15, 170, 190, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 190, 170, 0)
end Lpac3

proc Upac1
    drawfillarc (x, y, 15, 15, 130, 50, 14)
    drawfillarc (x, y, 15, 15, 50, 130, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 130, 50, 0)
end Upac1

proc Upac2
    drawfillarc (x, y, 15, 15, 105, 75, 14)
    drawfillarc (x, y, 15, 15, 75, 105, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 105, 75, 0)
end Upac2

proc Upac3
    drawfillarc (x, y, 15, 15, 110, 80, 14)
    drawfillarc (x, y, 15, 15, 80, 110, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 110, 80, 0)
end Upac3

proc Dpac1
    drawfillarc (x, y, 15, 15, 295, 230, 14)
    drawfillarc (x, y, 15, 15, 230, 295, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 295, 230, 0)
end Dpac1

proc Dpac2
    drawfillarc (x, y, 15, 15, 275, 245, 14)
    drawfillarc (x, y, 15, 15, 245, 275, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 275, 245, 0)
end Dpac2

proc Dpac3
    drawfillarc (x, y, 15, 15, 270, 290, 14)
    drawfillarc (x, y, 15, 15, 290, 270, 0)
    delay (30)
    drawfillarc (x, y, 15, 15, 270, 290, 0)
end Dpac3


%outside
drawfillbox (15, 10, 805, 600, 1)
drawfillbox (20, 20, 795, 590, 0)

%aliens box
drawfillbox (335, 295, 485, 385, 4)
drawfillbox (345, 305, 475, 375, 0)
drawfillbox (425, 386, 395, 375, 15)


%bottom left
drawfillbox (80, 80, 90, 300, 43)
drawfillbox (80, 290, 270, 300, 43)
drawfillbox (80, 80, 200, 90, 43)

drawfillbox (270, 80, 280, 160, 43)
drawfillbox (280, 160, 160, 150, 43)

drawfillbox (160, 220, 350, 230, 43)
drawfillbox (340, 80, 350, 230, 43)
drawfillbox (340, 80, 480, 90, 43)
drawfillbox (470, 80, 480, 230, 43)
drawfillbox (405, 150, 415, 230, 43)

%bottom left
drawfillbox (550, 80, 560, 230, 43)
drawfillbox (550, 80, 720, 90, 43)
drawfillbox (720, 80, 730, 230, 43)
drawfillbox (730, 230, 550, 220, 43)

drawfillbox (720, 300, 730, 460, 43)
drawfillbox (730, 470, 550, 460, 43)

drawfillbox (650, 300, 660, 400, 43)
drawfillbox (660, 400, 550, 390, 43)
drawfillbox (550, 400, 560, 300, 43)
drawfillbox (550, 300, 660, 310, 43)

drawfillbox (550, 520, 730, 530, 43)

drawfillbox (470, 530, 480, 460, 43)
drawfillbox (480, 460, 340, 450, 43)

drawfillbox (400, 530, 80, 520, 43)
drawfillbox (80, 530, 90, 380, 43)
drawfillbox (80, 380, 270, 390, 43)

drawfillbox (160, 450, 270, 460, 43)



var pacdots : array 1 .. 4, 1 .. 200 of int

for number : 1 .. 13
    pacdots (1, number) := 60 * number - 13
    pacdots (2, number) := 50
    pacdots (3, number) := 1
    pacdots (4, number) := 1
end for

for number2 : 14 .. 26
    pacdots (1, number2) := (60 * (number2 - 13)) - 13
    pacdots (2, number2) := 560
    pacdots (3, number2) := 1
    pacdots (4, number2) := 1
end for

for number3 : 27 .. 35
    pacdots (1, number3) := 47
    pacdots (2, number3) := ((number3 - 26) * 60) - 10
    pacdots (3, number3) := 1
    pacdots (4, number3) := 1
end for

for number4 : 36 .. 44
    pacdots (1, number4) := 768
    pacdots (2, number4) := ((number4 - 35) * 60) - 10
    pacdots (3, number4) := 1
    pacdots (4, number4) := 1
end for

for number5 : 45 .. 52
    pacdots (1, number5) := 520
    pacdots (2, number5) := ((number5 - 44) * 60) + 50
    pacdots (3, number5) := 1
    pacdots (4, number5) := 1
end for

for number6 : 53 .. 56
    pacdots (1, number6) := 300
    pacdots (2, number6) := ((number6 - 52) * 60) + 195
    pacdots (3, number6) := 1
    pacdots (4, number6) := 1
end for

for number7 : 57 .. 59
    pacdots (1, number7) := (number7 - 55) * 60
    pacdots (2, number7) := 255
    pacdots (3, number7) := 1
    pacdots (4, number7) := 1
end for

for number8 : 60 .. 62
    pacdots (1, number8) := (number8 - 54) * 60
    pacdots (2, number8) := 255
    pacdots (3, number8) := 1
    pacdots (4, number8) := 1
end for

for number9 : 63 .. 65
    pacdots (1, number9) := ((number9 - 53) * 60) - 10
    pacdots (2, number9) := 255
    pacdots (3, number9) := 1
    pacdots (4, number9) := 1
end for

for number10 : 66 .. 71
    pacdots (1, number10) := ((number10 - 64) * 60) + 10
    pacdots (2, number10) := 495
    pacdots (3, number10) := 1
    pacdots (4, number10) := 1
end for

for number11 : 72 .. 74
    pacdots (1, number11) := ((number11 - 70) * 60) + 10
    pacdots (2, number11) := 420
    pacdots (3, number11) := 1
    pacdots (4, number11) := 1
end for

for number12 : 75 .. 77
    pacdots (1, number12) := ((number12 - 69) * 60)
    pacdots (2, number12) := 420
    pacdots (3, number12) := 1
    pacdots (4, number12) := 1
end for

for number13 : 78 .. 80
    pacdots (1, number13) := ((number13 - 69) * 60) + 35
    pacdots (2, number13) := 420
    pacdots (3, number13) := 1
    pacdots (4, number13) := 1
end for

for number14 : 81 .. 83
    pacdots (1, number14) := ((number14 - 71) * 60) - 25
    pacdots (2, number14) := 500
    pacdots (3, number14) := 1
end for

for number15 : 84 .. 87
    pacdots (1, number15) := ((number15 - 82) * 60)
    pacdots (2, number15) := 200
    pacdots (3, number15) := 1
end for

for number16 : 88 .. 90
    pacdots (1, number16) := ((number16 - 86) * 60)
    pacdots (2, number16) := 120
    pacdots (3, number16) := 1
end for

for number17 : 91 .. 92
    pacdots (1, number17) := 310
    pacdots (2, number17) := ((number17 - 89) * 60) - 15
    pacdots (3, number17) := 1
end for

for number18 : 93 .. 95
    pacdots (1, number18) := ((number18 - 91) * 60)
    pacdots (2, number18) := 350
    pacdots (3, number18) := 1
end for

for number19 : 96 .. 97
    pacdots (1, number19) := 375
    pacdots (2, number19) := ((number19 - 94) * 60) + 10
    pacdots (3, number19) := 1
end for

for number20 : 98 .. 99
    pacdots (1, number20) := 440
    pacdots (2, number20) := ((number20 - 96) * 60) + 10
    pacdots (3, number20) := 1
end for

for number21 : 100 .. 101
    pacdots (1, number21) := 690
    pacdots (2, number21) := ((number21 - 95) * 60) + 5
    pacdots (3, number21) := 1
end for


for drawing : 1 .. 101
    if pacdots (3, drawing) = 1 then
        drawfilloval (pacdots (1, drawing), (pacdots (2,
            drawing)), 5, 5, 15)
    end if
end for


loop
    if hasch = true then
        getch (keypress)

    end if



    for checking : 1 .. 101
        if pacdots (3, checking) = 1 then
            if x >= pacdots (1, checking) - 15 and x <= pacdots (1,
                    checking)
                    + 15 and y >= pacdots (2, checking) - 15
                    and y <= pacdots (2, checking) + 15 then
                pacdots (3, checking) := 0
                sound (300, 10)
            end if

        end if
    end for



    finish := 0
    for ending : 1 .. 101
        finish := finish + pacdots (3, ending)
    end for



    if ord (keypress) = 205 then

        x := x + 9

        if counter = 1 then
            Rpac1
        elsif counter = 2 then
            Rpac2
        elsif counter = 3 then
            Rpac3
        end if


    elsif ord (keypress) = 203 then
        x := x - 9

        if counter = 1 then
            Lpac1
        elsif counter = 2 then
            Lpac2
        elsif counter = 3 then
            Lpac3
        end if


    elsif ord (keypress) = 200 then
        y := y + 9

        if counter = 1 then
            Upac1
        elsif counter = 2 then
            Upac2
        elsif counter = 3 then
            Upac3
        end if

    elsif ord (keypress) = 208 then
        y := y - 9

        if counter = 1 then
            Dpac1
        elsif counter = 2 then
            Dpac2
        elsif counter = 3 then
            Dpac3
            sound (1000, 200)
        end if
    end if

    counter := counter + 1

    if x <= 50 then
        x := 50
    elsif x >= 50 and x <= 65 and y >= 65 and y <= 315 then
        x := 50
    elsif x >= 50 and x <= 65 and y >= 370 and y <= 540 then
        x := 50

    elsif x >= 100 and x <= 115 and y >= 135 and y <= 315 then
        x := 116

    elsif x >= 100 and x <= 115 and y >= 65 and y < 135 then
        x := 116


    elsif x >= 100 and x <= 115 and y >= 370 and y <= 540 then
        x := 116

    elsif x >= 290 and x <= 305 and y >= 65 and y <= 180 then
        x := 306
    elsif x >= 240 and x <= 255 and y >= 65 and y <= 180 then
        x := 239

    elsif x >= 350 and x <= 375 and y >= 65 and y <= 250 then
        x := 376

    elsif x >= 315 and x <= 330 and y >= 65 and y <= 250 then
        x := 314

    elsif x >= 500 and x <= 515 and y >= 65 and y <= 250 then
        x := 516

    elsif x >= 443 and x <= 463 and y >= 65 and y <= 250 then
        x := 441

    elsif x >= 425 and x <= 440 and y >= 125 and y <= 250 then
        x := 441

    elsif x >= 375 and x <= 390 and y >= 125 and y <= 250 then
        x := 379

    elsif x >= 300 and x <= 315 and y >= 280 and y <= 400 then
        x := 299

    elsif x >= 500 and x <= 515 and y >= 280 and y <= 400 then
        x := 516

    elsif x >= 520 and x <= 535 and y >= 65 and y <= 240 then
        x := 519

    elsif x >= 740 and x <= 755 and y >= 65 and y <= 240 then
        x := 755

    elsif x >= 738 and x <= 753 and y >= 280 and y <= 480 then
        x := 758

    elsif x >= 690 and x <= 705 and y >= 280 and y <= 420 then
        x := 690
    elsif x >= 690 and x <= 705 and y > 420 and y <= 480 then
        x := 690
        y := 430
        y := y - 1

    elsif x >= 675 and x <= 690 and y >= 280 and y <= 415 then
        x := 691

    elsif x >= 516 and x <= 531 and y >= 280 and y <= 415 then
        x := 519

    elsif x >= 500 and x <= 515 and y >= 430 and y <= 550 then
        x := 516

    elsif x >= 440 and x <= 455 and y >= 430 and y <= 550 then
        x := 439

    elsif y >= 50 and y <= 65 and x >= 50 and x <= 220 then
        y := 50

    elsif y >= 100 and y <= 115 and x >= 50 and x <= 220 then
        y := 115

    elsif y >= 120 and y <= 135 and x >= 140 and x <= 300 then
        y := 120

    elsif y >= 170 and y <= 185 and x >= 140 and x <= 300 then
        y := 185

    elsif y >= 190 and y <= 205 and x >= 140 and x <= 350 then
        y := 190

    elsif y >= 242 and y <= 257 and x >= 140 and x <= 350 then
        y := 260

    elsif y >= 260 and y <= 275 and x >= 65 and x <= 285 then
        y := 260

    elsif y >= 310 and y <= 325 and x >= 65 and x <= 285 then
        y := 325

    elsif y >= 350 and y <= 365 and x >= 65 and x <= 285 then
        y := 350

    elsif y >= 405 and y <= 420 and x >= 65 and x <= 285 then
        y := 418

    elsif y >= 420 and y <= 435 and x >= 130 and x <= 285 then
        y := 420

    elsif y >= 475 and y <= 490 and x >= 130 and x <= 285 then
        y := 490

    elsif y >= 490 and y <= 505 and x >= 65 and x <= 420 then
        y := 490

    elsif y >= 550 and y <= 565 and x >= 65 and x <= 420 then
        y := 565

    elsif y >= 420 and y <= 435 and x >= 320 and x <= 500 then
        y := 420

    elsif y >= 475 and y <= 490 and x >= 320 and x <= 500 then
        y := 490

    elsif y >= 400 and y <= 415 and x >= 320 and x <= 500 then
        y := 415

    elsif y >= 270 and y <= 285 and x >= 320 and x <= 500 then
        y := 270

    elsif y >= 50 and y <= 65 and x >= 320 and x <= 500 then
        y := 50

    elsif y >= 100 and y <= 115 and x >= 320 and x <= 500 then
        y := 117

    elsif y >= 50 and y <= 65 and x >= 535 and x <= 750 then
        y := 50

    elsif y >= 240 and y <= 255 and x >= 535 and x <= 750 then
        y := 255

    elsif y >= 270 and y <= 285 and x >= 535 and x <= 680 then
        y := 270

    elsif y >= 410 and y <= 425 and x >= 535 and x <= 680 then
        y := 425

    elsif y >= 430 and y <= 445 and x >= 535 and x <= 740 then
        y := 430

    elsif y >= 480 and y <= 495 and x >= 535 and x <= 740 then
        y := 495

    elsif y >= 495 and y <= 510 and x >= 535 and x <= 740 then
        y := 495

    elsif y >= 550 and y <= 565 and x >= 535 and x <= 740 then
        y := 565



        %Little End Pieces

    elsif x >= 210 and x <= 225 and y >= 70 and y <= 100 then
        x := 225

    elsif x >= 135 and x <= 150 and y >= 140 and y <= 170 then
        x := 135

    elsif x >= 135 and x <= 150 and y >= 200 and y <= 240 then
        x := 135

    elsif x >= 280 and x <= 295 and y >= 270 and y <= 310 then
        x := 295

    elsif x >= 280 and x <= 295 and y >= 370 and y <= 400 then
        x := 295

    elsif x >= 280 and x <= 295 and y >= 430 and y <= 480 then
        x := 295

    elsif x >= 130 and x <= 145 and y >= 430 and y <= 480 then
        x := 130

    elsif x >= 310 and x <= 325 and y >= 430 and y <= 480 then
        x := 310

    elsif x >= 410 and x <= 425 and y >= 490 and y <= 540 then
        x := 425

    elsif x >= 520 and x <= 535 and y >= 500 and y <= 550 then
        x := 520

    elsif x >= 740 and x <= 755 and y >= 510 and y <= 550 then
        x := 755

    elsif x >= 520 and x <= 535 and y >= 460 and y <= 490 then
        x := 520

    elsif y >= 55 and y <= 70 and x >= 240 and x <= 280 then
        y := 55

    elsif y >= 240 and y <= 255 and x >= 380 and x <= 420 then
        y := 255

    elsif y >= 120 and y <= 135 and x >= 380 and x <= 420 then
        y := 120

    elsif y >= 240 and y <= 255 and x >= 430 and x <= 490 then
        y := 255

    elsif y >= 270 and y <= 285 and x >= maxx - 90 and x <= maxx -
            60 then
        y := 270

    elsif y >= 540 and y <= 555 and x >= 450 and x <= 490 then
        y := 555

    elsif x >= maxx - 30 then
        x := maxx - 30
    end if

    if y <= 50 then
        y := 50
    elsif y >= maxy - 40 then
        y := maxy - 40
    end if

    if counter = 3 then
        counter := 0
    end if


    exit when finish = 0
end loop

Sponsor
Sponsor
Sponsor
sponsor
Dark-X




PostPosted: Fri May 14, 2004 8:42 am   Post subject: (No subject)

Hey man thats nice BUT.

theres a graphic bug. look at the pic... Twisted Evil



untitled.JPG
 Description:
it eats some of the boarders
 Filesize:  56.75 KB
 Viewed:  3563 Time(s)

untitled.JPG


Ultimus




PostPosted: Sat May 15, 2004 2:59 pm   Post subject: (No subject)

This is GREAT, but... I bet you spent a lot of time setting up all those little x/y limits so that the little dude doesn't devour and go through the walls, but it just isn't nessecary! You could have saved a few hour's time if you simply used color checking - whatdotcolor(x,y) - to see if there is a wall in front of him (color ahead not= background color) and stop him from moving there if that is the case. That way, you'd save time and many many pages of hd space Very Happy . See this example that I did as an assignment to see what I mean (though it is a bit glitchy).


newpac.t
 Description:

Download
 Filename:  newpac.t
 Filesize:  5.96 KB
 Downloaded:  311 Time(s)

Ultimus




PostPosted: Sat May 15, 2004 3:03 pm   Post subject: (No subject)

By the way, what I mean, Kit Kat, can be found in the procedure called "Advance" in the above example. There, the whatdotcolor functions check to see if the red wall is ahead.
Atma Weapon




PostPosted: Sat May 15, 2004 3:19 pm   Post subject: (No subject)

Dark-X wrote:
Hey man thats nice BUT.

theres a graphic bug. look at the pic... Twisted Evil


That's quite the hungry pac-man! Very Happy
the_short1




PostPosted: Sat May 15, 2004 10:30 pm   Post subject: (No subject)

if code is > 100 lines PLEASE attach the file....



good start... dont have much in the way of sounds / graphicfs.... but i like...

one thing.... i was unable to eat all dots correctly so i didn;t get the beep.... that would be bad if u were keeping track on how many dots were eaten and whatnot for scoreing..
also it was kinda hard to move around i kep runing into walls when i turnsed... maybe have it in increaments of 25 so u can turn easier//


all in all from the PacMasta himself.... c -> c+ not bad..
heres 10 bits +10 BITS!
the_short1




PostPosted: Sun May 16, 2004 10:03 am   Post subject: (No subject)

also.. i noticed u have 3! topics about the exact same program.... maybe change the subject to the first post and put the file in that first post so we dont have 1million topics about the same thing ok...


also.. please attacch the file.!
Geminibaby




PostPosted: Wed May 19, 2004 6:35 pm   Post subject: (No subject)

wow... that looks really nice... but it seems tooooo hungry, lolz~
Sponsor
Sponsor
Sponsor
sponsor
@DRI@N




PostPosted: Tue May 25, 2004 5:42 pm   Post subject: (No subject)

Good job, it is quite the program! There was only one problem, I found I could eat through one of the walls..
kit-kat-kid




PostPosted: Wed May 26, 2004 7:48 pm   Post subject: (No subject)

thanks for all the good news about it. its not done yet. ill try to fix any bugs
poly




PostPosted: Fri May 28, 2004 9:45 am   Post subject: (No subject)

Chris this is not your own work either!
Your friend gave you the disk with this on it (his buddy wrote it) and now your taking credit for it again.....
the_short1




PostPosted: Fri May 28, 2004 2:59 pm   Post subject: (No subject)

is that so...


hmm... ppl here at compsci dont take that kindly... claiming other pplz work is ur own.....
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  [ 12 Posts ]
Jump to:   


Style:  
Search: