Chaoskiller
 
 
 
    
		 | 
		
		
			
				  Posted: Mon Oct 26, 2009 9:44 pm    Post subject: Pacman Game Need help  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				I am using turing 4.1.1 and this is the code ive made so far: Okay so this isnt much and it does count points   . I need help with making boundaries. My boundaries are sketchy and i dont know how to make walls inside unless i get every coord, which would take a long time. Ive used whatdotcolour and it didnt work out for me. Also i need to know how to make it that you only get the points once for that dot. Any suggestions for my script would be helpful  
 
 
% Jordan Upiter October 20,2009
 
% Pacman Game
 
import GUI
 
 
setscreen ("graphics: max, max")
 
 
var pacmanx, pacmany, ballx, bally, score, font: int
 
var ballx1, bally1, ballx2, bally2, ballx3, bally3, ballx4, bally4, ballx5, bally5, ballx6, bally6 : int
 
var ballx7, bally7, ballx8, bally8, ballx9, bally9, ballx10, bally10, ballx11, bally11, ballx12, bally12, ballx13, bally13, ballx14, bally14 : int
 
var move : array char of boolean
 
pacmanx := 55
 
pacmany := 360
 
score := 0
 
font := Font.New ("Times New Roman:20")
 
ballx := 125
 
bally := 360
 
 
% Pacman when moving up
 
procedure pacmanUP
 
    drawfilloval (pacmanx, pacmany - 10, 25, 25, 7)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    drawfilloval (pacmanx + 10, pacmany + 2, 4, 4, 7)
 
    drawfillarc (pacmanx, pacmany, 26, 26, 45, 135, 7)
 
    delay (50)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    delay (50)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 7)
 
end pacmanUP
 
% Pacman when moving right
 
procedure pacmanRIGHT
 
    drawfilloval (pacmanx - 10, pacmany, 25, 25, 7)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    drawfilloval (pacmanx + 2, pacmany + 10, 4, 4, 7)
 
    drawfillarc (pacmanx, pacmany, 26, 26, 315, 45, 7)
 
    delay (50)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    delay (50)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 7)
 
end pacmanRIGHT
 
% Pacman when moving left
 
procedure pacmanLEFT
 
    drawfilloval (pacmanx + 10, pacmany, 25, 25, 7)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    drawfilloval (pacmanx + 6, pacmany + 6, 4, 4, 7)
 
    drawfillarc (pacmanx, pacmany, 26, 26, 135, 230, 7)
 
    delay (50)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    delay (50)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 7)
 
end pacmanLEFT
 
% Pacman when moving down
 
procedure pacmanDOWN
 
    drawfilloval (pacmanx, pacmany + 10, 25, 25, 7)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    drawfilloval (pacmanx + 6, pacmany + 6, 4, 4, 7)
 
    drawfillarc (pacmanx, pacmany, 26, 26, 225, 310, 7)
 
    delay (50)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    delay (50)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 7)
 
end pacmanDOWN
 
 
procedure Game
 
    cls
 
    colour (10)
 
    locate (4, 77)
 
    put score
 
    % Background fill colour
 
    drawfill (1, 1, 7, 7)
 
    % Dots First Row
 
    drawfillarc (ballx, bally, 7, 7, 0, 360, 42)
 
    drawline (5, 395, 635, 395, 10)
 
    drawline (5, 5, 5, 395, 10)
 
    drawline (5, 5, 600, 5, 10)
 
    drawbox (600, 360, 600, 5, 10)
 
    drawbox (600, 360, 635, 395, 10)
 
    Draw.Text ("Start Here", 6, 375, font, red)
 
    drawline (10, 360, 40, 360, red)
 
    drawline (30, 370, 40, 360, red)
 
    drawline (30, 350, 40, 360, red)
 
    drawfillbox (100, 100, 150, 200, grey)
 
    drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
    % User Input
 
    loop
 
        colour (10)
 
        colourback (7)
 
        locate (4, 76)
 
        put score
 
        drawline (5, 395, 635, 395, 10)
 
        drawline (5, 5, 5, 395, 10)
 
        drawline (5, 5, 600, 5, 10)
 
        drawbox (600, 360, 600, 5, 10)
 
        drawbox (600, 360, 635, 395, 10)
 
        Draw.Text ("Start Here", 6, 375, font, red)
 
        drawline (10, 360, 40, 360, red)
 
        drawline (30, 370, 40, 360, red)
 
        drawline (30, 350, 40, 360, red)
 
        drawfilloval (pacmanx, pacmany, 25, 25, 44)
 
        drawfilloval (pacmanx + 6, pacmany + 6, 4, 4, 7)
 
 
        Input.KeyDown (move)
 
 
        if move (KEY_UP_ARROW) then
 
            pacmany := pacmany + 5
 
            pacmanUP
 
        end if
 
        if move (KEY_RIGHT_ARROW) then
 
            pacmanx := pacmanx + 5
 
            pacmanRIGHT
 
        end if
 
        if move (KEY_LEFT_ARROW) then
 
            pacmanx := pacmanx - 5
 
            pacmanLEFT
 
        end if
 
        if move (KEY_DOWN_ARROW) then
 
            pacmany := pacmany - 5
 
            pacmanDOWN
 
        end if
 
 
        if pacmanx = ballx and pacmany = bally then
 
            drawfillarc (617, 377, 7, 7, 0, 360, 42)
 
            score := score + 10
 
        end if
 
 
        if pacmanx = 575 then
 
            pacmanx := pacmanx - 5
 
        end if
 
        if pacmany = 370 then
 
            pacmany := pacmany - 5
 
        end if
 
        if pacmanx = 30 then
 
            pacmanx := pacmanx + 5
 
        end if
 
        if pacmany = 30 then
 
            pacmany := pacmany + 5
 
        end if
 
 
    end loop
 
end Game
 
 
View.Set ("graphics:639;399,nobuttonbar")
 
var draw : int := GUI.CreateButtonFull (50, 10, 0, "Start",
 
    Game, 0, '^D', true)
 
 
loop
 
    exit when GUI.ProcessEvent
 
end loop | 
			 
			
				 | 
			 
		  |