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

Username:   Password: 
 RegisterRegister   
 going back to the main page of game...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
air_force91




PostPosted: Tue Jan 13, 2004 7:13 pm   Post subject: going back to the main page of game...

here's the thing...ive got this huge project and only 3 days left to complete it...im getting really stressed out and need some of ur help...now on my "instructions page" i want to add the possibility of a user clicking on the screen to be taken to the "choice page" where different options are available...the problem is im new in the turing area and can''t figure out the solution...here's my game so far...and the "game page" will contain different parts of the computer which are to be dragged onto the oher side of the screen and placed in the correct box...

code:
var winID : int
        winID := Window.Open ("position:800;350,graphics:800;350")
       
  View.Set ("nocursor")
       


colourback (red)
cls

%Import computer picture
var comppic : int := Pic.FileNew ("computerback.bmp")
Pic.Draw (comppic, maxx div 2 - (Pic.Width (comppic) div 2), maxy div 2 - Pic.Height (comppic) div 2, picMerge)
var fontID : int := Font.New ("Franklin Gothic Medium:16:bold")
Font.Draw ("Welcome To", 300, 300, fontID, green)
Font.Draw ("...", 350, 275, fontID, yellow)

%3D effect for "The Ultimate MB!!"

var size : int := 40
var text : string
var text1 := "The Ultimate MB!!"
var ch : string (1)

var afontID : array 1 .. size of int

for i : size div 2 .. size
    afontID (i) := Font.New ("Tahoma:" + intstr (i))
end for


procedure Text3D (text : string)
    for t : 1 .. length (text)
        for i : size div 2 .. size
            Font.Draw (text (t), t * size, 170, afontID (i), 20 + floor
                (i / size * 15))
        end for
    end for
end Text3D

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% You have to insert the picture before the text, so that                   %
%  the text will overlap the picture                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Text3D (text1)

%ball animation

%"enter any key"
var bfontID : int := Font.New ("Arial:10:bold")
Font.Draw ("Press any key to continue...", 597, 25, bfontID, blue)
getch (ch)

cls

%%%%%%%%%%%%%%%%%%%%%%%%%%%%second page%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

colourback (3)
cls


var sizea : int
var text2 : string
sizea := 15
var text3 := "The Ultimate MB!!"

var cfontID : array 1 .. sizea of int

for i : sizea div 2 .. sizea
    cfontID (i) := Font.New ("Tahoma:" + intstr (i))

end for

procedure Text3D1 (text2 : string)


    for t : 1 .. length (text2)

        for i : sizea div 2 .. sizea
            Font.Draw (text2 (t), t * sizea, 315, cfontID (i), 20 + floor
                (i / size * 50))

        end for
    end for


end Text3D1
Text3D1 (text3)

%%Import computer picture

var comppic1 : int := Pic.FileNew ("comp3.bmp")
Pic.Draw (comppic1, 50 div 2, 20 div 2, 0)


%%%%%%%%%%%%%%%%%%%%%%buttons

%3rd button

Draw.FillBox (550, 40, 667, 90, 5)
Draw.Box (550, 40, 667, 90, 1)

var dfontID : int := Font.New ("Arial:12:bold")
Font.Draw ("Exit", 590, 60, dfontID, black)

%2nd button

Draw.FillBox (550, 140, 667, 190, 5)
Draw.Box (550, 140, 667, 190, 1)

var efontID : int := Font.New ("Arial:12:bold")
Font.Draw ("Start Game", 562, 160, efontID, black)

%1st button

Draw.FillBox (550, 240, 667, 290, 5)
Draw.Box (550, 240, 667, 290, 1)

var ffontID : int := Font.New ("Arial:12:bold")
Font.Draw ("Instructions", 562, 260, ffontID, black)

%%%mouse detect--*click*

loop

    var x, y, btn : int
    Mouse.Where (x, y, btn)

    if x >= 550 and x <= 667 and y >= 240 and y <= 290 and btn = 1 then
        cls
        colourback (blue)
        cls

        %%%%%%%%%%%%%%%%%instructions page%%%%%%%%%%%%%%%%%%%%%%%%%%%

        var gfontID : int := Font.New ("Tahoma:15:bold")

        var hfontID : int := Font.New ("Arial:12:bold")

        Font.Draw ("Instructions!!", 5, 325, gfontID, yellow)

        delay (800)

        Font.Draw ("1) After clicking 'Start Game', you are led to a screen with an empty motherboard and several ", 50, 260, hfontID, yellow)
        Font.Draw ("motherboard parts on the side.", 67, 240, hfontID, yellow)

        delay (800)

        Font.Draw ("2) The object of the game is to drag and place the parts in their correct place on the ", 50, 180, hfontID, yellow)
        Font.Draw ("motherboard.", 67, 160, hfontID, yellow)

        delay (800)

        Font.Draw ("3) For each correct placement, you receive one point and LEDs perform an effect on the", 50, 100, hfontID, yellow)
        Font.Draw ("posterboard included. If placement is incorrect, part next to lighted LED illustrates", 67, 80, hfontID, yellow)
        Font.Draw ("correct placement.", 67, 60, hfontID, yellow)

        delay (100)

        Font.Draw ("Good Luck!", 340, 35, hfontID, yellow)

    elsif x >= 550 and x <= 667 and y >= 140 and y <= 190 and btn = 1 then

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%Start Game Page%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        cls
        colourback (5)
        cls

    elsif x >= 550 and x <= 667 and y >= 40 and y <= 90 and btn = 1 then

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%EXIT%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        Window.Close (winID)



    end if


end loop


i hope i can get this done by friday...i need ur help...and i was wondering how i could use the "procedure" command inside an "if" statement...coz i get an error whenever i use the command..i want a text delay effect (every word appears after a small delay) in the instructions page...thanx soooooooooooooooooooooooo much for ur help!!!! Exclamation
Sponsor
Sponsor
Sponsor
sponsor
air_force91




PostPosted: Tue Jan 13, 2004 7:15 pm   Post subject: (No subject)

i forgot to mention that the "choice page" comes before the "instructions page"...so the user has to click on the "instructions" button to get to the "instructions page" and if the user wants to go back to the "choice page"....he/she needs to click on the screen...but how do program the game for the user to be taken back to the "choice page" whenever he or she clicks on a box at the bottom of the window on every page of the game? Confused
DanShadow




PostPosted: Tue Jan 13, 2004 7:44 pm   Post subject: (No subject)

Put a loop before the first loop, then redeclare what all the variables are equal to. (what you want them to be, if u want to change them) Also put another end loop after the end loop. then in the middle loop, put an exit command where you want to restart your program. Hope this helps!
air_force91




PostPosted: Wed Jan 14, 2004 6:27 am   Post subject: (No subject)

im sorry...i don't get it...where does the loop begin and end? Crying or Very sad
DanShadow




PostPosted: Wed Jan 14, 2004 8:31 am   Post subject: (No subject)

This is your code:
code:

loop
%All the main program here
end loop

Here is what it should be like:
code:

loop
%Re-define any variables you want to
   loop
     %Main Program Here
   exit when (the exit condition is fufilled)
   end loop
end loop

Do you understand? This way, when your exit condition is fufilled, it restarts the program in a way. But if you want to really restart your program, right under t he first loop, redeclare want you want all the variables to be equal to. Pretty easy 8)
air_force91




PostPosted: Wed Jan 14, 2004 4:27 pm   Post subject: (No subject)

i thought i got what u meant but i tried it and it doesn't work...what i was doing is inserting a loop in the "Instructions page"...at the beginning and i didn't redeclare any variables coz i don't know what u mean...can u pls cut and paste my code and insert the things u told me to do...coz i don't understand...im sorry...
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  [ 6 Posts ]
Jump to:   


Style:  
Search: