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

Username:   Password: 
 RegisterRegister   
 i'm making a game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hotsnow




PostPosted: Wed Jan 21, 2009 4:29 pm   Post subject: i'm making a game

hey guys, so I have my final project due for Turing in about 2 days, and I have my game basically done. my game has levels and after every level i have to exit the game and restart to get to the next level - b/c u get a password after u finish each level-- so at the title screen you enter that password and you go the level you were on. the problem is that I want to move to the next level ,after i finish one level, without having to exit the game ( which is very annoying...trust me -_- ) but i cant do it b/c then i will have to copy paste the whole game like ...a lotta times....

I really hope you guys know what m trying to say...
any help would be appreciated...
thanx....

P.S. I would show you guys my code but there a lot of ppl who go on this site in my class so i dun wan dem to take it and plus my teacher go on dis site as well, dun wanna get in that kinda shyt..
Sponsor
Sponsor
Sponsor
sponsor
Ethan3210




PostPosted: Wed Jan 21, 2009 4:58 pm   Post subject: Re: i'm making a game

I can't explain it very well, but if you know how to use procedures...

You can put every level in a procedure, and at the top of the program, put "include "-insertfilename-"" and then you go to the end of each level, put the procedure name for the next level at the end, and it should run automatically through them all.(?)
hotsnow




PostPosted: Wed Jan 21, 2009 5:35 pm   Post subject: Re: i'm making a game

Ethan3210 @ Wed Jan 21, 2009 4:58 pm wrote:
I can't explain it very well, but if you know how to use procedures...

You can put every level in a procedure, and at the top of the program, put "include "-insertfilename-"" and then you go to the end of each level, put the procedure name for the next level at the end, and it should run automatically through them all.(?)



I kinda have an idea of what you are saying but see the thing is..m basically done and this thing is due in like 1.5 days, if I use procedures then i'll have to recode a whole lotta stuff...which would take 4ever...
but I really appreciate your help...thanx alot man

please feel free to give other suggestions
Insectoid




PostPosted: Wed Jan 21, 2009 5:38 pm   Post subject: RE:i\'m making a game

Posting code on this site isn't bad. As long as your teacher knows that you posted it (ie knows your username), you should be fine. If someone tried to steel it, just point to this. Problem solved.

We really can't help all that much without the code.
hotsnow




PostPosted: Wed Jan 21, 2009 6:04 pm   Post subject: Re: RE:i\'m making a game

insectoid @ Wed Jan 21, 2009 5:38 pm wrote:
Posting code on this site isn't bad. As long as your teacher knows that you posted it (ie knows your username), you should be fine. If someone tried to steel it, just point to this. Problem solved.

We really can't help all that much without the code.


ya..i guess..well heres the code
BUT you have to click the little empty box on the right hand side to start from level1
and please donate bits if u liked my game..wud be much appreciated =)

Turing:
var title, subt1, subt2, subt3, subt4, wrongpass : int % title and subtitle  font variable
var password1, winnerloser : int %password font
var pass1, pass2, pass3, pass4, pass5 : string
var x, y, button : int


%An assert statement is used to make sure that a certain requirement is met.
%This requirement is given by the trueFalseExpn.
%The trueFalseExpn is evaluated. If it is true, all is well and execution continues.
%If it is false, execution is terminated with an appropriate message.
%below are the variables for the fonts
%winner or loser font
winnerloser := Font.New ("Arial:45:bold")
assert winnerloser > 0
%password font
password1 := Font.New ("Arial:20:bold")
assert password1 > 0
title := Font.New ("Swis721 Ex BT:35:bold")
assert title > 0
subt1 := Font.New ("Swis721 Ex BT:12:bold")
assert subt1 > 0
subt2 := Font.New ("Swis721 Ex BT:13:bold")
assert subt2 > 0
wrongpass := Font.New ("Chiller:20:bold")
assert wrongpass > 0
subt3 := Font.New ("Swis721 Ex BT:20:bold")
assert subt2 > 0
subt4 := Font.New ("Swis721 Ex BT:10:bold")
assert subt4 > 0
setscreen ("offscreenonly")



loop
    mousewhere (x, y, button)
    %the gray background at the title screen
    drawfillbox (0, 0, maxx, maxy, grey)
    %draws the font
    Font.Draw ("Invisible Walls Maze", 30, 320, title, black) % Title
    drawbox (245, 200, 325, 230, black) %exit box
    Font.Draw ("Press any button on Printer Port Interface to start", 60, 250, subt1, black)

    Font.Draw ("L2 Password:", 20, 160, subt2, black) %password font
    Font.Draw ("L3 Password:", 20, 130, subt2, black) %password font
    Font.Draw ("L4 Password:", 20, 100, subt2, black) %password font
    Font.Draw ("L5 Password:", 20, 70, subt2, black) %password font
    drawbox (155, 155, 250, 175, black) %password box for L2
    drawbox (155, 125, 250, 145, black) %password box for L3
    drawbox (155, 95, 250, 115, black) % password box for L4
    drawbox (155, 65, 250, 85, black) % password box for L4

    drawbox (500, 155, 550, 175, black) %delete at school

    Font.Draw ("EXIT", 252, 205, subt3, black) %the exit button font
    Font.Draw ("Created by HotSnow", 190, 20, subt4, black) %credit font
    % tells the computer to exit if the exit button is pressed
    if button = 1 and 245 <= x and x <= 325 and 200 <= y and y <= 230
            then
        cls
        exit
    end if
    View.Update
    if button = 1 and 500 <= x and x <= 550 and 155 <= y and y <= 175
        % tells the computer if any button on PPI is pressed, start game
        %var val : int := PC.ParallelGet (1)
        %if (val div 16) mod 2 = 0
        %        or (val div 32) mod 2 = 0
        %       or (val div 128) mod 2 = 1
        %      or (val div 64) mod 2 = 0
        %     or (val div 8) mod 2 = 0
            then
        % turn all LEDs on
        %parallelput (255)
        cls
        %draws a screen of the path and the boundaries
        locatexy (40, 360)
        %start button
        put "Click to Start"
        drawbox (35, 375, 155, 345, black)
        drawfillbox (0, 0, 200, 100, black)
        drawfillbox (400, 100, 640, 400, black)
        drawfillbox (0, 400, 5, 100, black)
        drawfillbox (0, 400, 400, 395, black)
        drawfillbox (0, 0, 640, 5, black)
        drawfillbox (maxx, 0, 635, 100, black)
        drawbox (530, 70, 600, 40, black)
        %once the start button is clicked, then cover the boundaries
        loop
            mousewhere (x, y, button)
            if button = 1 and 35 <= x and x <= 155 and 345 <= y and y <= 375
                    then
                cls
                drawbox (530, 70, 600, 40, black) %finish button
                loop
                    mousewhere (x, y, button)

                    if button = 0 and 0 <= x and x <= 200 and 0 <= y and y <= 100
                            or 400 <= x and x <= 640 and 100 <= y and y <= 400
                            or 0 <= x and x <= 5 and 100 <= y and y <= 400
                            or 0 <= x and x <= 400 and 395 <= y and y <= 400
                            or 0 <= x and x <= 640 and 0 <= y and y <= 5
                            or 635 <= x and x <= 640 and 0 <= y and y <= 100
                            then
                        cls
                        drawfillbox (0, 0, maxx, maxy, brightred)
                        locatexy (260, 200)
                        Font.Draw ("You Lose!", 150, 200, winnerloser, black)
                        View.Update
                        Font.Draw ("restart the game to replay", 170, 150, subt1, black)
                        View.Update
                        exit
                    end if
                    if button = 1 and 530 <= x and x <= 600 and 40 <= y and y <= 70
                            then
                        cls
                        drawfillbox (0, 0, maxx, maxy, brightgreen)
                        Font.Draw ("Level 1 Complete", 80, 300, winnerloser, green)
                        View.Update
                        Font.Draw ("Password: easyhuh", 160, 100, password1, black)
                        Font.Draw ("Enter password at title screen to start Level 2", 100, 80, subt1, black)
                        View.Update
                        exit

                    end if
                    View.Update

                end loop
                View.Update
            end if
            View.Update
        end loop
        View.Update
    end if
    if button = 1 and 155 <= x and x <= 250 and 155 <= y and y <= 175
            then
        View.Update
        locatexy (160, 160)
        get pass1
        View.Update
        if pass1 not= "easyhuh"
                then
            Font.Draw ("Invalid Password", 310, 160, subt2, black)
            View.Update
        end if
        if pass1 = "easyhuh"
                then
            View.Update
            cls
            View.Update
            locatexy (40, 360)
            put "Click to Start"
            drawbox (35, 375, 155, 345, black)                     %start button
            drawbox (530, 70, 600, 40, black)                 %finish button
            drawfillbox (0, 0, 200, 100, black)                 %box in bottom left
            drawfillbox (400, 100, 640, 400, black)                 %box in top right
            drawfillbox (0, 400, 5, 100, black)                 %border on the left side
            drawfillbox (0, 400, 400, 395, black)                 %border on top
            drawfillbox (0, 0, 640, 5, black)                 %border along the bottom
            drawfillbox (maxx, 0, 635, 100, black)                 %border on bottom-right corner
            drawfillbox (400, 150, 300, 400, black)
            drawfillbox (0, 100, 100, 300, black)
            View.Update
            loop
                mousewhere (x, y, button)
                if button = 1 and 35 <= x and x <= 155 and 345 <= y and y <= 375
                        then
                    cls
                    drawbox (530, 70, 600, 40, black)    %finish button
                    View.Update
                    loop
                        mousewhere (x, y, button)
                        if button = 0 and 0 <= x and x <= 200 and 0 <= y and y <= 100
                                or 400 <= x and x <= 640 and 100 <= y and y <= 400
                                or 0 <= x and x <= 5 and 100 <= y and y <= 400
                                or 0 <= x and x <= 400 and 395 <= y and y <= 400
                                or 0 <= x and x <= 640 and 0 <= y and y <= 5
                                or 635 <= x and x <= 640 and 0 <= y and y <= 100
                                or 300 <= x and x <= 400 and 150 <= y and y <= 400
                                or 0 <= x and x <= 100 and 100 <= y and y <= 300
                                then
                            cls
                            drawfillbox (0, 0, maxx, maxy, brightred)
                            locatexy (260, 200)
                            View.Update
                            Font.Draw ("You Lose!", 150, 200, winnerloser, black)
                            View.Update
                            Font.Draw ("restart the game to replay", 170, 150, subt1, black)
                            View.Update
                            exit
                        end if

                        if button = 1 and 530 <= x and x <= 600 and 40 <= y and y <= 70
                                then
                            cls

                            drawfillbox (0, 0, maxx, maxy, brightgreen)
                            Font.Draw ("Level 2 Complete", 80, 300, winnerloser, green)
                            View.Update
                            Font.Draw ("Password: bithard", 160, 100, password1, black)
                            Font.Draw ("Enter password at title screen to start Level 3", 110, 80, subt1, black)
                            View.Update
                            exit
                        end if
                        View.Update
                    end loop
                    View.Update
                end if
                View.Update
            end loop
            View.Update
        end if
        View.Update
        delay (1000)
    end if
    View.Update

    if button = 1 and 155 <= x and x <= 250 and 125 <= y and y <= 145
            then
        View.Update
        locatexy (160, 140)
        get pass3
        View.Update
        if pass3 not= "bithard"
                then
            Font.Draw ("Invalid Password", 310, 140, subt2, black)
            View.Update
            delay (1000)
        end if
        if pass3 = "bithard"
                then
            cls
            View.Update
            locatexy (40, 360)
            put "Click to Start"
            drawbox (35, 375, 155, 345, black) %start button
            drawbox (530, 70, 600, 40, black)    %finish button
            drawfillbox (0, 0, 200, 100, black) %box in bottom left
            drawfillbox (400, 100, 640, 400, black) %box in top right
            drawfillbox (0, 400, 5, 100, black)   %border on the left side
            drawfillbox (0, 400, 400, 395, black) %border on top
            drawfillbox (0, 0, 640, 5, black)   %border along the bottom
            drawfillbox (maxx, 0, 635, 100, black) %border on bottom-right corner
            drawfillbox (400, 150, 300, 400, black) %second box on right
            drawfillbox (0, 100, 100, 300, black) %second box on left
            drawfillbox (100, 300, 230, 280, black) % bar sticking out from top left
            drawfillbox (180, 150, 355, 200, black) % bar sticking out from top right
            loop
                mousewhere (x, y, button)
                if button = 1 and 35 <= x and x <= 155 and 345 <= y and y <= 375
                        then
                    cls
                    drawbox (530, 70, 600, 40, black)    %finish button
                    View.Update
                    loop
                        mousewhere (x, y, button)
                        if button = 0 and 0 <= x and x <= 200 and 0 <= y and y <= 100
                                or 400 <= x and x <= 640 and 100 <= y and y <= 400
                                or 0 <= x and x <= 5 and 100 <= y and y <= 400
                                or 0 <= x and x <= 400 and 395 <= y and y <= 400
                                or 0 <= x and x <= 640 and 0 <= y and y <= 5
                                or 635 <= x and x <= 640 and 0 <= y and y <= 100
                                or 400 <= x and x <= 300 and 150 <= y and y <= 400
                                or 0 <= x and x <= 100 and 100 <= y and y <= 300
                                or 100 <= x and x <= 230 and 280 <= y and y <= 300
                                or 180 <= x and x <= 335 and 150 <= y and y <= 200

                                then
                            cls
                            drawfillbox (0, 0, maxx, maxy, brightred)
                            locatexy (260, 200)
                            Font.Draw ("You Lose!", 150, 200, winnerloser, black)
                            View.Update
                            Font.Draw ("restart the game to replay", 170, 150, subt1, black)
                            View.Update
                            exit
                        end if
                        if button = 1 and 530 <= x and x <= 600 and 40 <= y and y <= 70
                                then
                            cls
                            drawfillbox (0, 0, maxx, maxy, brightgreen)
                            Font.Draw ("Level 3 Complete", 80, 300, winnerloser, green)
                            View.Update
                            Font.Draw ("Password: hardnow?", 160, 100, password1, black)
                            Font.Draw ("Enter password at title screen to start Level 4", 100, 80, subt1, black)
                            View.Update
                            exit
                        end if
                        View.Update
                    end loop
                    View.Update
                end if
                View.Update
            end loop
            View.Update
        end if
        View.Update
    end if
    View.Update
    if button = 1 and 155 <= x and x <= 250 and 95 <= y and y <= 115
            then
        locatexy (160, 110)
        get pass4
        if pass4 not= "hardnow?"
                then
            Font.Draw ("Invalid Password", 310, 100, subt2, black)
            View.Update
            delay (1000)
        end if
        View.Update
        if pass4 = "hardnow?"
                then
            cls
            View.Update
            locatexy (40, 360)
            put "Click to Start"
            drawbox (35, 375, 155, 345, black) %start button
            drawbox (530, 70, 600, 40, black)    %finish button
            drawfillbox (0, 0, 200, 100, black) %box in bottom left
            drawfillbox (400, 100, 640, 400, black) %box in top right
            drawfillbox (0, 400, 5, 100, black)   %border on the left side
            drawfillbox (0, 400, 400, 395, black) %border on top
            drawfillbox (0, 0, 640, 5, black)   %border along the bottom
            drawfillbox (maxx, 0, 635, 100, black) %border on bottom-right corner
            drawfillbox (400, 150, 300, 400, black) %second box on right
            drawfillbox (0, 100, 100, 300, black) %second box on left
            drawfillbox (100, 300, 230, 280, black) % bar sticking out from top left
            drawfillbox (180, 150, 355, 200, black) % bar sticking out from top right
            drawfillbox (240, 150, 255, 50, black)         % bar sticking out from bottom right bar
            drawfillbox (300, 0, 315, 100, black) %bar sticking out from center-bottom
            loop
                mousewhere (x, y, button)
                if button = 1 and 35 <= x and x <= 155 and 345 <= y and y <= 375
                        then
                    cls
                    drawbox (530, 70, 600, 40, black) %finish button
                    View.Update
                    loop
                        mousewhere (x, y, button)
                        if button = 0 and 0 <= x and x <= 200 and 0 <= y and y <= 100
                                or 400 <= x and x <= 640 and 100 <= y and y <= 400
                                or 0 <= x and x <= 5 and 100 <= y and y <= 400
                                or 0 <= x and x <= 400 and 395 <= y and y <= 400
                                or 0 <= x and x <= 640 and 0 <= y and y <= 5
                                or 635 <= x and x <= 640 and 0 <= y and y <= 100
                                or 400 <= x and x <= 300 and 150 <= y and y <= 400
                                or 0 <= x and x <= 100 and 100 <= y and y <= 300
                                or 100 <= x and x <= 230 and 280 <= y and y <= 300
                                or 180 <= x and x <= 335 and 150 <= y and y <= 200
                                or 240 <= x and x <= 255 and 50 <= y and y <= 150
                                or 300 <= x and x <= 315 and 0 <= y and y <= 100
                                then
                            cls
                            drawfillbox (0, 0, maxx, maxy, brightred)
                            locatexy (260, 200)
                            Font.Draw ("You Lose!", 150, 200, winnerloser, black)
                            View.Update
                            Font.Draw ("restart the game to replay", 170, 150, subt1, black)
                            View.Update
                            exit
                        end if
                        if button = 1 and 530 <= x and x <= 600 and 40 <= y and y <= 70
                                then
                            cls
                            drawfillbox (0, 0, maxx, maxy, brightgreen)
                            Font.Draw ("Level 4 Complete", 80, 300, winnerloser, green)
                            View.Update
                            Font.Draw ("Password: ugotskills", 160, 100, password1, black)
                            Font.Draw ("Enter password at title screen to start Level 5", 100, 80, subt1, black)
                            View.Update
                            exit
                        end if
                        View.Update
                    end loop
                    View.Update
                end if
                View.Update
            end loop
            View.Update
        end if
        View.Update
    end if
    View.Update
    if button = 1 and 155 <= x and x <= 250 and 65 <= y and y <= 85
            then
        locatexy (160, 75)
        get pass4
        if pass4 not= "ugotskills"
                then
            Font.Draw ("Invalid Password", 310, 75, subt2, black)
            View.Update
            delay (1000)
        end if
        View.Update
        if pass4 = "ugotskills"
                then
            cls
            View.Update
            locatexy (40, 360)
            put "Click to Start"
            drawbox (35, 375, 155, 345, black) %start button
            drawbox (530, 70, 600, 40, black)    %finish button
            drawfillbox (0, 0, 200, 100, black) %box in bottom left
            drawfillbox (400, 100, 640, 400, black) %box in top right
            drawfillbox (0, 400, 5, 100, black)   %border on the left side
            drawfillbox (0, 400, 400, 395, black) %border on top
            drawfillbox (0, 0, 640, 5, black)   %border along the bottom
            drawfillbox (maxx, 0, 635, 100, black) %border on bottom-right corner
            drawfillbox (400, 150, 300, 400, black) %second box on right
            drawfillbox (0, 100, 100, 300, black) %second box on left
            drawfillbox (100, 300, 230, 280, black) % bar sticking out from top left
            drawfillbox (180, 150, 355, 200, black) % bar sticking out from top right
            drawfillbox (240, 150, 255, 50, black)         % bar sticking out from bottom right bar
            drawfillbox (300, 0, 315, 100, black) %bar sticking out from center-bottom
            drawfillbox (180, 200, 195, 235, black) %
            drawfillbox (135, 200, 145, 235, black) %
            drawfillbox (135, 100, 145, 165, black) %
            drawfillbox (400, 100, 410, 60, black) %
            drawfillbox (400, 0, 410, 40, black) %
            drawfillbox (445, 40, 495, 60, black)
            loop
                mousewhere (x, y, button)
                if button = 1 and 35 <= x and x <= 155 and 345 <= y and y <= 375
                        then
                    cls
                    drawbox (530, 70, 600, 40, black) %finish button
                    View.Update
                    loop
                        mousewhere (x, y, button)
                        if button = 0 and 0 <= x and x <= 200 and 0 <= y and y <= 100
                                or 400 <= x and x <= 640 and 100 <= y and y <= 400
                                or 0 <= x and x <= 5 and 100 <= y and y <= 400
                                or 0 <= x and x <= 400 and 395 <= y and y <= 400
                                or 0 <= x and x <= 640 and 0 <= y and y <= 5
                                or 635 <= x and x <= 640 and 0 <= y and y <= 100
                                or 400 <= x and x <= 300 and 150 <= y and y <= 400
                                or 0 <= x and x <= 100 and 100 <= y and y <= 300
                                or 100 <= x and x <= 230 and 280 <= y and y <= 300
                                or 180 <= x and x <= 335 and 150 <= y and y <= 200
                                or 240 <= x and x <= 255 and 50 <= y and y <= 150
                                or 300 <= x and x <= 315 and 0 <= y and y <= 100
                                or 180 <= x and x <= 195 and 200 <= y and y <= 235
                                or 135 <= x and x <= 200 and 145 <= y and y <= 235
                                or 135 <= x and x <= 145 and 100 <= y and y <= 165
                                or 400 <= x and x <= 410 and 100 <= y and y <= 60
                                or 400 <= x and x <= 410 and 0 <= y and y <= 40
                                or 445 <= x and x <= 495 and 40 <= y and y <= 60
                                then
                            cls
                            drawfillbox (0, 0, maxx, maxy, brightred)
                            locatexy (260, 200)
                            Font.Draw ("You Lose!", 150, 200, winnerloser, black)
                            View.Update
                            Font.Draw ("restart the game to replay", 170, 150, subt1, black)
                            View.Update
                        end if
                        if button = 1 and 530 <= x and x <= 600 and 40 <= y and y <= 70
                                then
                            cls
                            drawfillbox (0, 0, maxx, maxy, brightgreen)
                            Font.Draw ("Level 5 Complete", 80, 300, winnerloser, green)
                            View.Update
                            Font.Draw ("CONGRATULATION", 160, 100, password1, black)
                            Font.Draw ("You have finished the game...please exit and let others try =)", 80, 80, subt1, black)
                            View.Update
                            exit
                        end if
                        View.Update
                    end loop
                    View.Update
                end if
                View.Update
            end loop
            View.Update
        end if
        View.Update
    end if
    View.Update
end loop
setscreen ("nooffscreenonly")


Mod Edit: The language is supposed to go in between the quotes
code:
[syntax="turing"]Code Here[/syntax]
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  [ 5 Posts ]
Jump to:   


Style:  
Search: