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

Username:   Password: 
 RegisterRegister   
 Help me with my hangman game (GUI HELP)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
renorso




PostPosted: Wed May 21, 2014 3:42 pm   Post subject: Help me with my hangman game (GUI HELP)

What is it you are trying to achieve?
My hangman game's buttons wont work properly


What is the problem you are having?
When i click a, or any button, only the a button turns to an asterisk and disables.

Describe what you have tried to solve this problem
No idea how to fix it

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Look below

Turing:


<%HENRY HO
%HANGMAN
import GUI
setscreen ("graphics:800;500")

var buttons : array 1 .. 26 of int
forward procedure change (buttons : array 1 .. * of int)


%Got too lazy to do individual buttons, so yea
proc button
    change (buttons)
    put "Hi"
end button


%This is the backround
colourback (11)
Draw.FillBox (0, 0, maxx, maxy, 11)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%The Letter Buttons, they are part of an array
buttons (1) := GUI.CreateButtonFull (40, 100, 50, "A", button, 50, "a", true)
buttons (2) := GUI.CreateButtonFull (100, 100, 50, "B", button, 50, "b", true)
buttons (3) := GUI.CreateButtonFull (160, 100, 50, "C", button, 50, "c", true)
buttons (4) := GUI.CreateButtonFull (220, 100, 50, "D", button, 50, "d", true)
buttons (5) := GUI.CreateButtonFull (280, 100, 50, "E", button, 50, "e", true)
buttons (6) := GUI.CreateButtonFull (340, 100, 50, "F", button, 50, "f", true)
buttons (7) := GUI.CreateButtonFull (400, 100, 50, "G", button, 50, "g", true)
buttons (8) := GUI.CreateButtonFull (460, 100, 50, "H", button, 50, "h", true)
buttons (9) := GUI.CreateButtonFull (520, 100, 50, "I", button, 50, "i", true)
buttons (10) := GUI.CreateButtonFull (580, 100, 50, "J", button, 50, "j", true)
buttons (11) := GUI.CreateButtonFull (640, 100, 50, "K", button, 50, "k", true)
buttons (12) := GUI.CreateButtonFull (700, 100, 50, "L", button, 50, "l", true)
buttons (13) := GUI.CreateButtonFull (40, 50, 50, "M", button, 50, "m", true)
buttons (14) := GUI.CreateButtonFull (100, 50, 50, "N", button, 50, "n", true)
buttons (15) := GUI.CreateButtonFull (160, 50, 50, "O", button, 50, "o", true)
buttons (16) := GUI.CreateButtonFull (220, 50, 50, "P", button, 50, "p", true)
buttons (17) := GUI.CreateButtonFull (280, 50, 50, "Q", button, 50, "q", true)
buttons (18) := GUI.CreateButtonFull (340, 50, 50, "R", button, 50, "r", true)
buttons (19) := GUI.CreateButtonFull (400, 50, 50, "S", button, 50, "s", true)
buttons (20) := GUI.CreateButtonFull (460, 50, 50, "T", button, 50, "t", true)
buttons (21) := GUI.CreateButtonFull (520, 50, 50, "U", button, 50, "u", true)
buttons (22) := GUI.CreateButtonFull (580, 50, 50, "V", button, 50, "v", true)
buttons (23) := GUI.CreateButtonFull (640, 50, 50, "W", button, 50, "w", true)
buttons (24) := GUI.CreateButtonFull (700, 50, 50, "X", button, 50, "x", true)
buttons (25) := GUI.CreateButtonFull (280, 0, 50, "Y", button, 50, "y", true)
buttons (26) := GUI.CreateButtonFull (400, 0, 50, "Z", button, 50, "z", true)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%This is to change the letter to an *
body proc change
    for i : 1 .. 26
        GUI.SetLabel (buttons (i), "*")
        GUI.Disable (buttons (i))
        exit
    end for
end change


%Drawing the sticks
Draw.FillBox (570, 160, 590, 400, black)     %Left Line
Draw.FillBox (560, 160, 700, 180, black)     %Bottom Line
Draw.FillBox (560, 400, 700, 420, black)     %Top Line
Draw.FillBox (680, 400, 700, 370, black)     %Right Line

%Drawing the person
Draw.FillOval (690, 340, 30, 30, black)     %Head
Draw.FillBox (685, 245, 695, 370, black)    %Body
Draw.ThickLine (650, 190, 691, 250, 10, black) %Left Leg
Draw.ThickLine (740, 190, 691, 250, 10, black) %Right Leg


loop
    exit when GUI.ProcessEvent
end loop
>



Please specify what version of Turing you are using
Newest
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed May 21, 2014 7:05 pm   Post subject: RE:Help me with my hangman game (GUI HELP)

try
code:

GUI.Disable (buttons (i))
put "just disabled button ", i

and describe what your code is doing before/during/after
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: