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

Username:   Password: 
 RegisterRegister   
 ISP whatdotcolor problem again...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BladeOfDeath




PostPosted: Sun Jan 04, 2004 9:28 am   Post subject: ISP whatdotcolor problem again...

This time I said screw making pacman stop, if he hits a wall he dies. Who would run into a wall and be fine. Well this game he burns in hell, actually i just came here to check why the code doesn't work. I need help because its due tomorrow this is just the raw code for the game but here it is anyway...


code:

View.Set ("graphics:offscreenonly")
setscreen ("graphics:vga")
setscreen ("nocursor")
setscreen ("noechoe")


%%%%%%%%%%Variables for Pacman%%%%%%%%%%

const pacWid : int := 12
var pacX, pacY, pacXchange, pacYchange, pacMth, pacMth1, mthCls, mthChange :
    int
pacX := 100
pacY := 100
pacXchange := 0
pacYchange := 0
pacMth := 0
pacMth1 := 360
mthCls := 0
mthChange := 0
var reply : string (1)
var kill : boolean := false
const bgclr : int := 7

%%%%%%%%%%Screen Procedures%%%%%%%%%%

procedure background
    drawfillbox (maxx div 2 - 5, maxy - 50, maxx div 2 + 5, maxy - 100, 1)
    drawfillbox (0, maxy - 50, maxx, maxy - 55, 1)
    drawfillbox (0, maxy - 55, 5, maxy - 150, 1)
    drawfillbox (maxx, maxy - 55, maxx - 5, maxy - 150, 1)
    drawfillbox (0, maxy - 150, 145, maxy - 155, 1)
    drawfillbox (maxx, maxy - 150, maxx - 145, maxy - 155, 1)
    drawfillbox (140, maxy - 155, 145, maxy - 200, 1)
    drawfillbox (maxx - 140, maxy - 155, maxx - 145, maxy - 200, 1)
    drawfillbox (0, maxy - 200, 145, maxy - 205, 1)
    drawfillbox (maxx - 145, maxy - 200, maxx, maxy - 205, 1)
    drawfillbox (0, maxy - 235, 145, maxy - 240, 1)
    drawfillbox (maxx, maxy - 235, maxx - 145, maxy - 240, 1)
    drawfillbox (0, 19, maxx, 14, 1)
    drawfillbox (0, 19, 5, 114, 1)
    drawfillbox (maxx, 19, maxx - 5, 114, 1)
    drawfillbox (0, 109, 145, 114, 1)
    drawfillbox (maxx, 114, maxx - 145, 109, 1)
    drawfillbox (140, 109, 145, 159, 1)
    drawfillbox (maxx - 140, 109, maxx - 145, 159, 1)
    drawfillbox (0, 159, 145, 164, 1)
    drawfillbox (maxx - 145, 400, maxx, 405, 1)
    drawbox (35, maxy - 85, 145, maxy - 120, 1)
    drawbox (maxx - 45, maxy - 85, maxx - 145, maxy - 120, 1)
    drawbox (180, maxy - 85, maxx div 2 - 40, maxy - 120, 1)
    drawbox (maxx - 180, maxy - 85, maxx div 2 + 40, maxy - 120, 1)
    drawbox (180, maxy - 150, 195, maxy - 205, 1)
    drawbox (maxx - 180, maxy - 150, maxx - 195, maxy - 205, 1)
    drawbox (230, maxy - 150, maxx - 230, maxy - 160, 1)
    drawbox (195, maxy - 190, 245, maxy - 205, 1)
    drawbox (maxx - 195, maxy - 190, maxx - 245, maxy - 205, 1)
    drawbox (280, maxy - 160, maxx - 280, maxy - 205, 1)
    drawbox (230, maxy - 235, maxx - 230, maxy - 290, 1)
    drawbox (240, maxy - 245, maxx - 240, maxy - 280, 1)
    drawbox (180, maxy - 235, 195, maxy - 290, 1)
    drawbox (maxx - 180, maxy - 235, maxx - 195, maxy - 290, 1)
    drawbox (180, maxy - 320, 245, 49, 1)
    drawbox (maxx - 180, maxy - 320, maxx - 245, 49, 1)
    drawbox (280, maxy - 320, maxx - 280, 49, 1)
    drawbox (40, maxy - 320, 145, 49, 1)
    drawbox (maxx - 40, maxy - 320, maxx - 145, 49, 1)
    drawline (195, maxy - 191, 195, maxy - 204, 7)
    drawline (maxx - 195, maxy - 191, maxx - 195, maxy - 204, 7)
    drawline (maxx div 2 - 38, maxy - 160, maxx div 2 + 39, maxy - 160, 7)
end background
%%%%%%%%%%Procedures%%%%%%%%%%

procedure pacRgt (pacX : int, pacY : int)
    pacMth := 30
    pacMth1 := 330
    drawfillarc (pacX + pacXchange, pacY + pacYchange, pacWid, pacWid,
        pacMth1, pacMth, bgclr)
    drawfillarc (pacX + pacXchange, pacY + pacYchange, pacWid, pacWid,
        pacMth - mthCls, pacMth1 + mthCls, 14)
end pacRgt

procedure pacUp (pacX : int, pacY : int)
    pacMth := 120
    pacMth1 := 60
    drawfillarc (pacX + pacXchange, pacY + pacYchange, pacWid, pacWid,
        pacMth1, pacMth, bgclr)
    drawfillarc (pacX + pacXchange, pacY + pacYchange, pacWid, pacWid,
        pacMth - mthCls, pacMth1 + mthCls, 14)
end pacUp

procedure pacDown (pacX : int, pacY : int)
    pacMth := 300
    pacMth1 := 240
    drawfillarc (pacX + pacXchange, pacY + pacYchange, pacWid, pacWid,
        pacMth1, pacMth, bgclr)
    drawfillarc (pacX + pacXchange, pacY + pacYchange, pacWid, pacWid,
        pacMth - mthCls, pacMth1 + mthCls, 14)
end pacDown

procedure pacLeft (pacX : int, pacY : int)
    pacMth := 210
    pacMth1 := 150
    drawfillarc (pacX + pacXchange, pacY + pacYchange, pacWid, pacWid,
        pacMth1, pacMth, bgclr)
    drawfillarc (pacX + pacXchange, pacY + pacYchange, pacWid, pacWid,
        pacMth - mthCls, pacMth1 + mthCls, 14)
end pacLeft

procedure clrPac (pacX : int, pacY : int)
    drawfilloval (pacX + pacXchange, pacY + pacYchange, pacWid + 1, pacWid +
        1, 7)
end clrPac

procedure hit (pacX, pacY : int)
    if whatdotcolor (pacX, pacY) = 1 then
        kill := true
    else
        kill := false
    end if
end hit


%%%%%%%%%%Program%%%%%%%%%%
colourback (black)
cls
pacRgt (pacX, pacY)
background
colourback (black)
getch (reply)
mthChange := 2
loop
    if hasch then
        getch (reply)
    else
        reply := reply
    end if
    if reply = chr (200) then
        hit (pacX, pacY + 13)
        clrPac (pacX, pacY)
        pacYchange := pacYchange + 1
        pacUp (pacX, pacY)

    elsif reply = chr (208) then
        hit (pacX, pacY-13)
        clrPac (pacX, pacY)
        pacYchange := pacYchange - 1
        pacDown (pacX, pacY )
    elsif reply = chr (205) then
        hit (pacX + 13, pacY)
        clrPac (pacX, pacY)
        pacXchange := pacXchange + 1
        pacRgt (pacX, pacY)
    elsif reply = chr (203) then
        hit (pacX - 13, pacY)
        clrPac (pacX, pacY)
        pacXchange := pacXchange - 1
        pacLeft (pacX, pacY)
    end if
    delay (10)
    mthCls := mthCls + mthChange
    if mthCls = 30 or mthCls = -6 then
        mthChange *= -1
    end if
    View.Update
    exit when kill = true
end loop
Sponsor
Sponsor
Sponsor
sponsor
Kuntzy




PostPosted: Sun Jan 04, 2004 3:04 pm   Post subject: (No subject)

Your whatdotcolor needs to read the pixel in front of the pac man, not his center.
BladeOfDeath




PostPosted: Sun Jan 04, 2004 3:07 pm   Post subject: (No subject)

And I would do this how exactly? I am pretty good at turing at school just no the whatdotcolor aspect so please dont mind me.
BladeOfDeath




PostPosted: Sun Jan 04, 2004 3:45 pm   Post subject: (No subject)

i fixed it a bit... he actually dies sometime now, but not all the time, he can eat walls a bit... Anyway i need help but here it is, its long so im no gonna repost ill make it a download.

PLEASE HELP!!! this is due tomorrow...



pacmangame.t
 Description:
its kinda weird but try to help please.

Download
 Filename:  pacmangame.t
 Filesize:  7.06 KB
 Downloaded:  217 Time(s)

BladeOfDeath




PostPosted: Sun Jan 04, 2004 5:15 pm   Post subject: (No subject)

I dont normally ask for help unless im really stuck so please try to help me someone? Sad Sad Sad Sad Crying or Very sad Crying or Very sad Crying or Very sad
BladeOfDeath




PostPosted: Sun Jan 04, 2004 6:27 pm   Post subject: (No subject)

CAN ANYONE HEAR ME?!?!?!?! PLEASE HELP I NEED THIS QUICKLY!!!!
Dan




PostPosted: Sun Jan 04, 2004 10:14 pm   Post subject: (No subject)

man it is the holidays, but dan allways likes a good pac man game so i thougth i whould fix it any way.

here you go Wink

it's not perfuick but what can you exspted when i am on hoiladays have not sleped in a few days.


bacily u where not checking the rigth spot for the color and i found some stuff in your code i did not know what it did so i just delted it Razz

seems to work ok



pacmangame.t
 Description:
tell your frends about us!

Download
 Filename:  pacmangame.t
 Filesize:  7 KB
 Downloaded:  238 Time(s)

Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
BladeOfDeath




PostPosted: Mon Jan 05, 2004 12:10 am   Post subject: (No subject)

Dan you are the king. *bows down to dan* You have saved my life!!!
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Mon Jan 05, 2004 9:46 pm   Post subject: (No subject)

Dance
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
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  [ 9 Posts ]
Jump to:   


Style:  
Search: