
-----------------------------------
razan45
Fri Jun 14, 2013 4:52 pm

Turing Help Quicly!!!!!! ASAP Need help to run this code please help asap
-----------------------------------

setscreen ("graphics:1260;910") % sets screen for the main menu


var font1, font2, font3, font4, font5, font6, font7 : int    % declares font variable
var back : int
back := Pic.FileNew ("good_back_button_good.bmp")
var lastback := Pic.Scale (back, Pic.Width (back) div 3, Pic.Height (back) div 3)

var difficulty : int

difficulty := 10

font1 := Font.New ("Fixedsys:90:bold")  % states font and size
font2 := Font.New ("Fixedsys:40:bold")
font3 := Font.New ("Fixedsys:30:bold")
font4 := Font.New ("Arial:30:bold")
font5 := Font.New ("Fixedsys:300:bold")
font6 := Font.New ("Fixedsys:20:bold")
font7 := Font.New ("Fixedsys:5:bold")

var car1x, car1y, car2x, car2y, car1colour, car2colour, car1win, car2win, counter1, counter2, car1lose, timer : int
var again : string
car1win := 0
car2win := 0
car1x := maxx div 2
car1y := maxy div 2
car2x := maxx div 2 + 10
car2y := maxy div 2

car1colour := 11
car2colour := 12
counter1 := 0
counter2 := 0
car1lose := 0
var car1direction, car2direction : string
car1direction := "left"
car2direction := "right"

var mode : string

var colours, ccolours : int

var linecolour : int

var x, y, button : int %vars for the mouse where code

proc onetwothree
    setscreen ("graphics:1260;910")
    cls
    
    Font.Draw ("3", maxx div 2, maxy div 2, font5, 12)
    delay (1000)
    cls
    
    Font.Draw ("2", maxx div 2, maxy div 2, font5, 44)
    delay (1000)
    cls
    
    Font.Draw ("1", maxx div 2, maxy div 2, font5, 48)
    delay (1000)
    cls
end onetwothree

proc mainmenu
    drawfillbox (0, 0, maxx, maxy, black) % draws a black background

    loop
        randint (colours, 1, 255)
        Font.Draw ("Light Cycle", 430, 750, font1, colours)     % Puts the name of the game

        Font.Draw ("Single Player", 430, 350, font2, colours) % draws single player in main menu screen

        Font.Draw ("Multiplayer", 430, 250, font2, colours) % draws multiplayer in main menu screen

        Font.Draw ("Controls", 430, 150, font2, colours) %draws controls in main menu


        mode := ""

        Mouse.Where (x, y, button)

        if x >= 426 and y >= 331 and x = 226 and x = 142 and x  600 and x < 980 and y < 620 and button = 1 then
                car1colour := 11
                drawbox (959, 599, 981, 621, 64)
                drawbox (989, 599, 1011, 621, 16)
                drawbox (1019, 599, 1041, 621, 16)
                drawbox (1049, 599, 1071, 621, 16)
                drawbox (1079, 599, 1101, 621, 16)
            elsif x > 990 and y > 600 and x < 1010 and y < 620 and button = 1 then
                car1colour := 12
                drawbox (959, 599, 981, 621, 16)
                drawbox (989, 599, 1011, 621, 64)
                drawbox (1019, 599, 1041, 621, 16)
                drawbox (1049, 599, 1071, 621, 16)
                drawbox (1079, 599, 1101, 621, 16)
            elsif x > 1020 and y > 600 and x < 1040 and y < 620 and button = 1 then
                car1colour := 14
                drawbox (959, 599, 981, 621, 16)
                drawbox (989, 599, 1011, 621, 16)
                drawbox (1019, 599, 1041, 621, 64)
                drawbox (1049, 599, 1071, 621, 16)
                drawbox (1079, 599, 1101, 621, 16)
            elsif x > 1050 and y > 600 and x < 1070 and y < 620 and button = 1 then
                car1colour := 10
                drawbox (959, 599, 981, 621, 16)
                drawbox (989, 599, 1011, 621, 16)
                drawbox (1019, 599, 1041, 621, 16)
                drawbox (1049, 599, 1071, 621, 64)
                drawbox (1079, 599, 1101, 621, 16)
            elsif x > 1080 and y > 600 and x < 1100 and y < 620 and button = 1 then
                car1colour := 93
                drawbox (959, 599, 981, 621, 16)
                drawbox (989, 599, 1011, 621, 16)
                drawbox (1019, 599, 1041, 621, 16)
                drawbox (1049, 599, 1071, 621, 16)
                drawbox (1079, 599, 1101, 621, 64)
            end if

            if x > 960 and y > 500 and x < 980 and y < 520 and button = 1 then
                car2colour := 11
                drawbox (959, 499, 981, 521, 64)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 990 and y > 500 and x < 1010 and y < 520 and button = 1 then
                car2colour := 12
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 64)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1020 and y > 500 and x < 1040 and y < 520 and button = 1 then
                car2colour := 14
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 64)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1050 and y > 500 and x < 1070 and y < 520 and button = 1 then
                car2colour := 10
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 64)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1080 and y > 500 and x < 1100 and y < 520 and button = 1 then
                car2colour := 93
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 64)
            end if

            if x > 960 and y > 500 and x < 980 and y < 520 and button = 1 then
                car2colour := 11
                drawbox (959, 499, 981, 521, 64)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 990 and y > 500 and x < 1010 and y < 520 and button = 1 then
                car2colour := 12
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 64)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1020 and y > 500 and x < 1040 and y < 520 and button = 1 then
                car2colour := 14
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 64)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1050 and y > 500 and x < 1070 and y < 520 and button = 1 then
                car2colour := 10
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 64)
                drawbox (1079, 499, 1101, 521, 16)
            elsif x > 1080 and y > 500 and x < 1100 and y < 520 and button = 1 then
                car2colour := 93
                drawbox (959, 499, 981, 521, 16)
                drawbox (989, 499, 1011, 521, 16)
                drawbox (1019, 499, 1041, 521, 16)
                drawbox (1049, 499, 1071, 521, 16)
                drawbox (1079, 499, 1101, 521, 64)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%
            if x > 950 and y > 300 and x < 970 and y < 320 and button = 1 then
                difficulty := 25
                drawbox (949, 299, 971, 321, 64) 
                drawbox (999, 299, 1021, 321, 16)
                drawbox (1049, 299, 1071, 321, 16)
                drawbox (1099, 299, 1121, 321, 16)
                drawbox (1149, 299, 1171, 321, 16)
            elsif x > 1000 and y > 300 and x < 1020 and y < 320 and button = 1 then
                difficulty := 20
                drawbox (949, 299, 971, 321, 16) 
                drawbox (999, 299, 1021, 321, 64)
                drawbox (1049, 299, 1071, 321, 16)
                drawbox (1099, 299, 1121, 321, 16)
                drawbox (1149, 299, 1171, 321, 16)
            elsif x > 1050 and y > 300 and x < 1070 and y < 320 and button = 1 then
                difficulty := 10
                drawbox (949, 299, 971, 321, 16) 
                drawbox (999, 299, 1021, 321, 16)
                drawbox (1049, 299, 1071, 321, 64)
                drawbox (1099, 299, 1121, 321, 16)
                drawbox (1149, 299, 1171, 321, 16)
            elsif x > 1100 and y > 300 and x < 1120 and y < 320 and button = 1 then
                difficulty := 5
                drawbox (949, 299, 971, 321, 16) 
                drawbox (999, 299, 1021, 321, 16)
                drawbox (1049, 299, 1071, 321, 16)
                drawbox (1099, 299, 1121, 321, 64)
                drawbox (1149, 299, 1171, 321, 16)
            elsif x > 1150 and y > 300 and x < 1170 and y < 320 and button = 1 then
                car2colour := 2
                drawbox (949, 299, 971, 321, 16) 
                drawbox (999, 299, 1021, 321, 16)
                drawbox (1049, 299, 1071, 321, 16)
                drawbox (1099, 299, 1121, 321, 16)
                drawbox (1149, 299, 1171, 321, 64)
            end if


            Font.Draw ("Note: If in Single Player mode, the Player 2 controls will not work.", 20, 150, font4, 42)
            Pic.Draw (lastback, 20, 20, 2)



            if x > 20 and y > 20 and x < 20 + Pic.Width (lastback) and y < 20 + Pic.Height (lastback) and button = 1 then
                mainmenu
                if mode = "controls" then
                    controls
                elsif mode = "single player" then
                    onetwothree
                    playagain1
                elsif mode = "multiplayer" then
                    onetwothree
                    playagain
                end if
            end if
            View.Update

        end loop
    end if
end controls

procedure grid
    drawfillbox (0, 0, maxx, maxy, black)
    for x : 1 .. maxy by 100
        drawline (0, maxy - x, maxx, maxy - x, 115)
    end for
    for x : 1 .. maxx by 100
        drawline (x, maxy, x, 0, 115)
    end for
end grid

procedure explode (x, y, Colour, spread : int)
    %creates the explosions that occur when cars die
    for i : 1 .. 1300
        Draw.Oval (x, y, i, i, Colour)

        if i > spread then
            Draw.FillOval (x, y, i - spread, i - spread, 7)
        end if
    end for
end explode

%declares variable


%procedure to drawcar1 for player 1
procedure drawcar1 (car1x, car1y, car1colour : int)


    Draw.Dot (car1x, car1y, car1colour)
    Draw.Dot (car1x + 1, car1y + 1, car1colour)
    Draw.Dot (car1x + 1, car1y - 1, car1colour)
    Draw.Dot (car1x - 1, car1y + 1, car1colour)
    Draw.Dot (car1x - 1, car1y - 1, car1colour)

    Draw.Dot (car1x, car1y + 1, car1colour)
    Draw.Dot (car1x + 1, car1y, car1colour)
    Draw.Dot (car1x - 1, car1y, car1colour)
    Draw.Dot (car1x, car1y - 1, car1colour)

end drawcar1
%procedure to drawcar2 for player 2
procedure drawcar2 (car2x, car2y, car2colour : int)
    % Draw Player 2
    Draw.Dot (car2x, car2y, car2colour)
    Draw.Dot (car2x + 1, car2y + 1, car2colour)
    Draw.Dot (car2x + 1, car2y - 1, car2colour)
    Draw.Dot (car2x - 1, car2y + 1, car2colour)
    Draw.Dot (car2x - 1, car2y - 1, car2colour)

    Draw.Dot (car2x, car2y + 1, car2colour)
    Draw.Dot (car2x + 1, car2y, car2colour)
    Draw.Dot (car2x, car2y - 1, car2colour)
    Draw.Dot (car2x - 1, car2y, car2colour)
    drawcar1 (car1x, car1y, car1colour)
end drawcar2
%procedure to movecar1 for player 1 using w,a,s,d
procedure movedirectioncar1 (var car1direction : string)
    % Player 1 movement is controled with w,a,s,d
    var chars : array char of boolean

    Input.KeyDown (chars)
    if chars ('w') then
        if car1direction not= "down" then
            car1direction := "up"
        end if
    elsif chars ('s') then
        if car1direction not= "up" then
            car1direction := "down"
        end if
    elsif chars ('a') then
        if car1direction not= "right" then
            car1direction := "left"
        end if
    elsif chars ('d') then
        if car1direction not= "left" then
            car1direction := "right"
        end if
    else
    end if
end movedirectioncar1
%procedure to movecar2 for player 2 using arrow keys
procedure movedirectioncar2 (var car2direction : string)
    % Player 2 movement is controled with the directional keys
    var chars : array char of boolean

    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        if car2direction not= "down" then
            car2direction := "up"
        end if
    elsif chars (KEY_DOWN_ARROW) then
        if car2direction not= "up" then
            car2direction := "down"
        end if
    elsif chars (KEY_LEFT_ARROW) then
        if car2direction not= "right" then
            car2direction := "left"
        end if
    elsif chars (KEY_RIGHT_ARROW) then
        if car2direction not= "left" then
            car2direction := "right"
        end if
    else
    end if
end movedirectioncar2

var movespeed : int := 3
%moving car1
procedure movecar1 (var car1x, car1y : int, car1direction : string, movespeed : int)


    % Player 1's movement
    if car1direction = "up" then
        car1y += movespeed
    elsif car1direction = "down" then
        car1y -= movespeed
    elsif car1direction = "left" then
        car1x -= movespeed
    elsif car1direction = "right" then
        car1x += movespeed
    end if
end movecar1
%moving car2
procedure movecar2 (var car2x, car2y : int, car2direction : string, movespeed : int)
    % Player 2's movement
    if car2direction = "up" then
        car2y += movespeed
    elsif car2direction = "down" then
        car2y -= movespeed
    elsif car2direction = "left" then
        car2x -= movespeed
    elsif car2direction = "right" then
        car2x += movespeed
    end if
end movecar2
%maingame
proc game


    drawcar1 (car1x, car1y, car1colour)
    drawcar2 (car2x, car2y, car2colour)
    movedirectioncar1 (car1direction)
    movedirectioncar2 (car2direction)
    delay (difficulty)
    movecar1 (car1x, car1y, car1direction, movespeed)
    movecar2 (car2x, car2y, car2direction, movespeed)
    %code for when the cars hit the sides,their or others lightcyle
    if car1x = 1260
            or car1y >= 910
            or car1y = 910
            or car2y = 1260
            or car1x = 910
            or car1y = 1260
            or car2x = 910
            or car2y = 1260
                    or car1x = 910
                    or car1y = 1260
                    or car2x = 910
                    or car2y = 1260
                        or car1x = 910
                        or car1y = 1260
                        or car2x = 910
                        or car2y = 910
            or car1y 