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

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




PostPosted: Wed Jun 08, 2005 8:09 pm   Post subject: Pacman Help

Hi everyone!

I have to make pacman for a project in Turing and I am having problems setting the boundaries so that pacman does eat the walls. I know I need to use View.What.Dot.Colour but how? Please tell me how or if you think there is another way other than View.What.Dot.Colour please advise. Please repond ASAP

Thanks

P.S Here is my code.


code:

var winID : int := Window.Open ("position:0;100, graphics:1000;650")
proc graphic
    drawfillbox (0, 0, 1000, 630, 16)
    colour (0)
    colourback (16)
end graphic

proc title
    graphic
    var font : int
    font := Font.New ("Comic Sans MS:16:Bold")
    Draw.Text ("PACMAN", 450, 600, font, brightblue)
end title
setscreen ("nocursor")
var key : string (1)
proc level1
    title
    %OutSide Wall
    Draw.ThickLine (20, 20, 980, 20, 10, brightblue)
    Draw.ThickLine (20, 20, 20, 580, 10, brightblue)
    Draw.ThickLine (20, 580, 980, 580, 10, brightblue)
    Draw.ThickLine (980, 580, 980, 20, 10, brightblue)

    % Left Pattern
    Draw.ThickLine (70, 70, 70, 285, 7, brightblue)
    Draw.ThickLine (70, 335, 70, 530, 7, brightblue)
    Draw.ThickLine (70, 335, 100, 335, 7, brightblue)
    Draw.ThickLine (100, 335, 100, 500, 7, brightblue)
    Draw.ThickLine (70, 285, 100, 285, 7, brightblue)
    Draw.ThickLine (100, 285, 100, 100, 7, brightblue)
    Draw.ThickLine (100, 100, 200, 100, 7, brightblue)
    Draw.ThickLine (200, 100, 200, 70, 7, brightblue)
    Draw.ThickLine (200, 70, 70, 70, 7, brightblue)
    Draw.ThickLine (100, 500, 200, 500, 7, brightblue)
    Draw.ThickLine (200, 530, 200, 500, 7, brightblue)
    Draw.ThickLine (200, 530, 70, 530, 7, brightblue)

    % Middle Box
    Draw.ThickLine (425, 240, 425, 370, 10, red)
    Draw.ThickLine (575, 240, 575, 370, 10, red)
    Draw.ThickLine (425, 370, 575, 370, 10, red)
    Draw.ThickLine (425, 240, 575, 240, 10, red)

    % Interior upper left pattern
    Draw.ThickLine (375, 420, 375, 500, 7, brightblue)
    Draw.ThickLine (345, 420, 345, 500, 7, brightblue)
    Draw.ThickLine (345, 420, 375, 420, 7, brightblue)
    Draw.ThickLine (475, 530, 250, 530, 7, brightblue)
    Draw.ThickLine (250, 530, 250, 500, 7, brightblue)
    Draw.ThickLine (250, 500, 345, 500, 7, brightblue)
    Draw.ThickLine (375, 500, 475, 500, 7, brightblue)
    Draw.ThickLine (475, 530, 475, 500, 7, brightblue)

    % Interior upper right pattern
    Draw.ThickLine (650, 420, 650, 500, 7, brightblue)
    Draw.ThickLine (620, 420, 620, 500, 7, brightblue)
    Draw.ThickLine (620, 420, 650, 420, 7, brightblue)
    Draw.ThickLine (750, 530, 525, 530, 7, brightblue)
    Draw.ThickLine (525, 530, 525, 500, 7, brightblue)
    Draw.ThickLine (525, 500, 620, 500, 7, brightblue)
    Draw.ThickLine (650, 500, 750, 500, 7, brightblue)
    Draw.ThickLine (750, 530, 750, 500, 7, brightblue)

    % Interior upper left pattern
    Draw.ThickLine (150, 335, 150, 450, 7, brightblue)
    Draw.ThickLine (295, 335, 295, 450, 7, brightblue)
    Draw.ThickLine (295, 335, 150, 335, 7, brightblue)
    Draw.ThickLine (295, 450, 150, 450, 7, brightblue)

    % Middle Left Pattern (Left of Red Box)
    Draw.ThickLine (345, 370, 375, 370, 7, brightblue)
    Draw.ThickLine (345, 370, 345, 240, 7, brightblue)
    Draw.ThickLine (375, 370, 375, 240, 7, brightblue)
    Draw.ThickLine (345, 240, 375, 240, 7, brightblue)

    % Interior lower left pattern
    Draw.ThickLine (150, 285, 150, 150, 7, brightblue)
    Draw.ThickLine (150, 150, 295, 150, 7, brightblue)
    Draw.ThickLine (295, 285, 295, 150, 7, brightblue)
    Draw.ThickLine (150, 285, 295, 285, 7, brightblue)

    % Interior lower left pattern
    Draw.ThickLine (375, 190, 375, 100, 7, brightblue)
    Draw.ThickLine (345, 190, 345, 100, 7, brightblue)
    Draw.ThickLine (345, 190, 375, 190, 7, brightblue)
    Draw.ThickLine (475, 70, 250, 70, 7, brightblue)
    Draw.ThickLine (250, 100, 250, 70, 7, brightblue)
    Draw.ThickLine (250, 100, 345, 100, 7, brightblue)
    Draw.ThickLine (375, 100, 475, 100, 7, brightblue)
    Draw.ThickLine (475, 70, 475, 100, 7, brightblue)

    % Interior lower right pattern
    Draw.ThickLine (650, 190, 650, 100, 7, brightblue)
    Draw.ThickLine (620, 190, 620, 100, 7, brightblue)
    Draw.ThickLine (620, 190, 650, 190, 7, brightblue)
    Draw.ThickLine (750, 70, 525, 70, 7, brightblue)
    Draw.ThickLine (525, 100, 525, 70, 7, brightblue)
    Draw.ThickLine (525, 100, 620, 100, 7, brightblue)
    Draw.ThickLine (650, 100, 750, 100, 7, brightblue)
    Draw.ThickLine (750, 70, 750, 100, 7, brightblue)

    % Middle Right Pattern (Right of Red Box)
    Draw.ThickLine (620, 370, 650, 370, 7, brightblue)
    Draw.ThickLine (620, 370, 620, 240, 7, brightblue)
    Draw.ThickLine (650, 370, 650, 240, 7, brightblue)
    Draw.ThickLine (620, 240, 650, 240, 7, brightblue)

    % Interior upper right pattern
    Draw.ThickLine (700, 335, 700, 450, 7, brightblue)
    Draw.ThickLine (845, 335, 845, 450, 7, brightblue)
    Draw.ThickLine (845, 335, 700, 335, 7, brightblue)
    Draw.ThickLine (845, 450, 700, 450, 7, brightblue)

    % Interior lower right pattern
    Draw.ThickLine (700, 285, 700, 150, 7, brightblue)
    Draw.ThickLine (700, 150, 845, 150, 7, brightblue)
    Draw.ThickLine (845, 285, 845, 150, 7, brightblue)
    Draw.ThickLine (700, 285, 845, 285, 7, brightblue)

    % Right Upper Pattern
    Draw.ThickLine (930, 335, 930, 530, 7, brightblue)
    Draw.ThickLine (930, 530, 800, 530, 7, brightblue)
    Draw.ThickLine (930, 335, 900, 335, 7, brightblue)
    Draw.ThickLine (900, 335, 900, 500, 7, brightblue)
    Draw.ThickLine (900, 500, 800, 500, 7, brightblue)
    Draw.ThickLine (800, 530, 800, 500, 7, brightblue)

    % Right Lower Pattern
    Draw.ThickLine (930, 70, 930, 285, 7, brightblue)
    Draw.ThickLine (800, 100, 800, 70, 7, brightblue)
    Draw.ThickLine (930, 285, 900, 285, 7, brightblue)
    Draw.ThickLine (930, 70, 800, 70, 7, brightblue)
    Draw.ThickLine (900, 285, 900, 100, 7, brightblue)
    Draw.ThickLine (900, 100, 800, 100, 7, brightblue)

    % Middle Lower Pattern
    Draw.ThickLine (425, 190, 570, 190, 7, brightblue)
    Draw.ThickLine (570, 190, 570, 150, 7, brightblue)
    Draw.ThickLine (570, 150, 425, 150, 7, brightblue)
    Draw.ThickLine (425, 190, 425, 150, 7, brightblue)

    % Middle Upper Pattern
    Draw.ThickLine (425, 420, 570, 420, 7, brightblue)
    Draw.ThickLine (570, 420, 570, 450, 7, brightblue)
    Draw.ThickLine (570, 450, 425, 450, 7, brightblue)
    Draw.ThickLine (425, 420, 425, 450, 7, brightblue)

    var key : string (1)
    var column, row : int
    column := 45
    row := 45
    drawfilloval (column, row, 15, 15, 14)
    drawfilloval (column - 5, row + 8, 3, 3, brightred)
    drawfilloval (column + 5, row + 8, 3, 3, brightred)
    drawfilloval (column, row - 5, 10, 1, 16)
    loop
        getch (key)
        if key = KEY_UP_ARROW then
            drawfilloval (column, row, 15, 15, 16)
            row := row + 10
        elsif key = KEY_DOWN_ARROW then
            drawfilloval (column, row, 15, 15, 16)
            row := row - 10
        elsif key = KEY_RIGHT_ARROW then
            drawfilloval (column, row, 15, 15, 16)
            column := column + 10
        else
            if key = KEY_LEFT_ARROW then
                drawfilloval (column, row, 15, 15, 16)
                column := column - 10
            end if
        end if
        drawfilloval (column, row, 15, 15, 14)
        drawfilloval (column - 5, row + 8, 3, 3, brightred)
        drawfilloval (column + 5, row + 8, 3, 3, brightred)
        drawfilloval (column, row - 5, 10, 1, 16)

    end loop
end level1


loop
    level1
    exit when key = (KEY_ESC)
end loop
Sponsor
Sponsor
Sponsor
sponsor
vagyb




PostPosted: Wed Jun 08, 2005 9:13 pm   Post subject: (No subject)

you can do this
for example if ur coordinates for pacman are X and Y
code:

if whatdotcolor (x+2, y+2) = blue then


after then u put w/e u want to happen if it touches a blue wall
Drakain Zeil




PostPosted: Wed Jun 08, 2005 9:45 pm   Post subject: (No subject)

What the guy above me said, and also, I suggest you take that map background and make it into a picture file:

quicker to load
it's easy to read
less lines of code.
for more there's no need

8)
vagyb




PostPosted: Wed Jun 08, 2005 9:52 pm   Post subject: (No subject)

Drakain Zeil wrote:
What the guy above me said, and also, I suggest you take that map background and make it into a picture file:

quicker to load
it's easy to read
less lines of code.
for more there's no need

8)


yep create it with paint as MAP.bmp file and load it on turing
var picture: int
picture := Pic.FileNew ("MAP.bmp")


to draw it put
Pic.Draw (picture, x,y, picMerge)
hacker101




PostPosted: Wed Jun 08, 2005 10:25 pm   Post subject: Thanks

Thanks for the response, the What.Dot.Colour should work

Another thing how would you go about drawing the dots for pacman to eat so that computer know when to execute the next level

I know haven't included the code but yeah

Thanks
vagyb




PostPosted: Wed Jun 08, 2005 10:48 pm   Post subject: (No subject)

well u would draw balls and use whatdotcolor again to detect the balls, and every time it eats a ball u can make a counter += 1, and whenever the counter reaches 30 or something the next level happens.

so

var counter: int:=0

if whatdotcolor (x,y) = yellow then
get rid of the balls here (u can take them off screen thats wat i usually do)
counter +=1
end if

if counter > 30 then
blabla new lvl
hacker101




PostPosted: Thu Jun 09, 2005 8:08 am   Post subject: Pacman Help

vagyb wrote:
you can do this
for example if ur coordinates for pacman are X and Y
code:

if whatdotcolor (x+2, y+2) = blue then


after then u put w/e u want to happen if it touches a blue wall



This doesn't work, here I attached the full pacman file. I have also tried using View.What.Dot.Colour

Please help asap.

Thanks



ISP.t
 Description:

Download
 Filename:  ISP.t
 Filesize:  31.49 KB
 Downloaded:  155 Time(s)

gohan




PostPosted: Fri Jun 10, 2005 1:47 pm   Post subject: (No subject)

LMAO...that is one hungry Pac man...(sry hacker101), but you gotta think that is funny...anyways, to get rid of the problem, just

|1|First draw it on paint(cause everyone has that,or at least should have it)
|2|Save as whatever(Pacmap.bmp)
|3|put this code in
code:
var Pacmap : int := Pic.FileNew ("Pacmap.bmp")
Pic.Draw (Pacmap, 0, 0, picCopy)

|4| Put Restrictions in (check jamonathin tutorial on Character Movement Restrictions)>>>>> http://www.compsci.ca/v2/viewtopic.php?t=8175
|5|Play the game (YEAH GUY)
Sponsor
Sponsor
Sponsor
sponsor
gohan




PostPosted: Fri Jun 10, 2005 1:49 pm   Post subject: (No subject)

LMAO...that is one hungry Pac man...(sry hacker101), but you gotta think that is funny...anyways, to get rid of the problem

|1|First draw it on paint(cause everyone has that,or at least should have it)
|2|Save as whatever(Pacmap.bmp)
|3|put this code in
code:
var Pacmap : int := Pic.FileNew ("Pacmap.bmp")
Pic.Draw (Pacmap, 0, 0, picCopy) % or however big you want it

|4| Put Restrictions in (check jamonathin tutorial on Character Movement Restrictions)>>>>> http://www.compsci.ca/v2/viewtopic.php?t=8175
|5|Play the game (YEAH GUY)
Drakain Zeil




PostPosted: Fri Jun 10, 2005 3:51 pm   Post subject: (No subject)

gohan wrote:
LMAO...that is one hungry Pac man...(sry hacker101), but you gotta think that is funny...anyways, to get rid of the problem, just

|1|First draw it on paint(cause everyone has that,or at least should have it)
|2|Save as whatever(Pacmap.bmp)
|3|put this code in
code:
var Pacmap : int := Pic.FileNew ("Pacmap.bmp")
Pic.Draw (Pacmap, 0, 0, picCopy)

|4| Put Restrictions in (check jamonathin tutorial on Character Movement Restrictions)>>>>> http://www.compsci.ca/v2/viewtopic.php?t=8175
|5|Play the game (YEAH GUY)
He doesn't even need to do it in paint. He already have the level drawn, there is some line in turing that exports to bmp for you... too bad I've forgotten it :p.

I used it in my pain program.
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  [ 10 Posts ]
Jump to:   


Style:  
Search: