
-----------------------------------
Devin_459326
Thu Jun 09, 2005 10:45 am

Hey I need help on a defend your castle project
-----------------------------------
my game has a bug click on the help button then click around the same bouttons are there to%*******************************************************************************
import GUI in "%oot/support/lib/GUI"
View.Set ("graphics")
%*******************************************************************************
%Variable Table
%*******************************************************************************
var Main_title_page : int
var Castle_page : int
var enemy1 : int
var enemy2 : int
var enemy3 : int
var enemy4 : int
var Castle_1 : int
var Main : int
%*******************************************************************************
%Procedures
%*******************************************************************************





%*******************************************************************************
%Procedure Main title screen
%*******************************************************************************
procedure MainTitlePage
    Main_title_page := Pic.FileNew ("MainPage.bmp")
    Pic.Draw (Main_title_page, 15, 5, picCopy)

end MainTitlePage
%*******************************************************************************
%Procedure Help Page 2
%*******************************************************************************
procedure Help_2
    cls
    put "Upgarades Page"
    put ""
    put ""
    put "Repair: This atribute gives you aditional heath for every level you complete "
    put ""
    put ""
    put "Tempel: This atribute gives you aditional people that you can controle"
    var a : int := GUI.CreateButton (225, 225, 0, "Main Page", MainTitlePage)
end Help_2
%*******************************************************************************
%Procedure Help File
%*******************************************************************************
procedure Help
    cls
    enemy1 := Pic.FileNew ("Enemy_1.bmp")
    enemy2 := Pic.FileNew ("Enemy_2.bmp")
    enemy3 := Pic.FileNew ("Enemy_3.bmp")
    enemy4 := Pic.FileNew ("Enemy_4.bmp")
    put "Enemy Totals"
    put ""
    put ""
    put " Point Total :20"
    put " # of throws to kill :1"
    put ""
    put ""
    put ""
    put ""
    Pic.Draw (enemy1, 200, 300, picCopy)
    put "Point Total :50"
    put " # of throws to kill :1"
    put ""
    put ""
    put ""
    Pic.Draw (enemy2, 200, 200, picCopy)
    put "Point Total :100"
    put " # of throws to kill :2"
    put ""
    put ""
    put ""
    Pic.Draw (enemy3, 200, 145, picCopy)
    put "Point Total :500"
    put " # of throws to kill :3"
    put ""
    put ""
    put ""
    Pic.Draw (enemy4, 200, 25, picCopy)
    var a : int := GUI.CreateButton (425, 225, 0, "List of upgrades", Help_2)
end Help
%*******************************************************************************
%Procedure Castle
%*******************************************************************************
procedure Castle
    cls
    Castle_page := Pic.FileNew ("CastlePage.bmp")
    Pic.Draw (Castle_page, 175, 50, picCopy)
    var a : int := GUI.CreateButton (225, 225, 0, "Castle #1", Help)
end Castle
%*******************************************************************************
%Programe
%*******************************************************************************
MainTitlePage
var b : int := GUI.CreateButton (286, 75, 0, "New Game", Castle)
var a : int := GUI.CreateButton (300, 30, 0, "Help", Help)
loop
    exit when GUI.ProcessEvent
end loop
%*******************************************************************************

-----------------------------------
jamonathin
Thu Jun 09, 2005 11:25 am


-----------------------------------
You need to disable those buttons when you move on to another menu screen.

Take a look at this example.

The three color radio buttons are enabled only when the color check box is selected.

        import GUI in "%oot/lib/GUI" 
        View.Set ("graphics:100;100") 
        
        var colorCheckBox, redRadio, greenRadio, blueRadio : int
        
        procedure DoNothing
        end DoNothing
        
        procedure ColorCheckBoxProc (filled : boolean)
            if filled then
                GUI.Enable (redRadio)
                GUI.Enable (greenRadio)
                GUI.Enable (blueRadio)
            else
                GUI.Disable (redRadio)
                GUI.Disable (greenRadio)
                GUI.Disable (blueRadio)
            end if
        end ColorCheckBoxProc
        
        colorCheckBox := GUI.CreateCheckBox (10, 80,
            "Use Color", ColorCheckBoxProc)
        redRadio := GUI.CreateRadioButton (33, 60, "Red", 0, DoNothing)
        greenRadio := GUI.CreateRadioButton (1, 1, "Green", 
            redRadio, DoNothing)
        blueRadio := GUI.CreateRadioButton (1, 1, "Blue", 
            greenRadio, DoNothing)
        ColorCheckBoxProc (false)
        
        loop
            exit when GUI.ProcessEvent
        end loop
