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

Username:   Password: 
 RegisterRegister   
 Concentration game =D
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mish




PostPosted: Wed Jan 17, 2007 6:27 pm   Post subject: Concentration game =D

heyy i'm working on a concentration game.. and i have all the buttons.. but they do nothing. they are clickable.. but i want to know how to store numbers that would flip over and are random when the user clicks on a button. any feedback would be great.
Sponsor
Sponsor
Sponsor
sponsor
Prince Pwn




PostPosted: Wed Jan 17, 2007 6:34 pm   Post subject: Re: Concentration game =D

When you click the button there is a procedure that is called. So if you have a variables like:
Turing:

var number1 : int

Then when you click the button, inside your procedure go:
Turing:

number1 := Rand.Int (1, 100) %stores a random number from 1 to 100

Then to "flip" over your number (erm I think you mean display) then simply:
Turing:

put number1

or
Turing:

Font.Draw (intstr (number1), 50, 100, defFontID, brightred)
mish




PostPosted: Wed Jan 17, 2007 6:42 pm   Post subject: Re: Concentration game =D

see the thing is LOL my numbers are in an array =/ i'm not sure if its right.. but it goes like :

import GUI
setscreen ("graphics:max;max,nobuttonbar")

var row := 6
var column := 6
var cards : array 1 .. 6, 1 .. 6 of int
var solved:array 1..18,1..2 of boolean
const size : int := 50
const border : int := 3
var cardBack : int


Draw.FillOval (size - 10, border + 15, size div border,
size div border, 103)
Draw.FillStar (border + 2, border + 2, border + size - 2,
border + size - 2, black)
cardBack := Pic.New (0, 0, 2 * border + size, 2 * border + size)


proc nothing
for x:1..6
for t:1..6
if cards (2,3)= GUI.GetEventWidgetID then
drawfillbox (240,360,305,445,black)
elsif cards (1,3)=GUI.GetEventWidgetID then
drawfillbox (120,360,185,445,black)

end if
end for
end for
end nothing

for r : 1 .. 6
for c : 1 .. 6
cards (r, c) := GUI.CreatePictureButtonFull (r * 120, c * 120, cardBack,nothing, 60, 80, '^B', false)
GUI.SetColor (cards (r, c), white)
end for
end for



loop
exit when GUI.ProcessEvent
end loop



i tried to randomly display the numbers and then convert them to string but it didn't work >.<
mish




PostPosted: Wed Jan 17, 2007 6:50 pm   Post subject: RE:Concentration game =D

basically.. that's the processing for my game. all i have so far at least XD i still have to figure out how to make the numbers appear randomly. also the cards have to flip back over if the numbers don't match. since yu're allowed to click 2 cards each turn... if the cards do not match.. the cards would have to flip back. if the numbers do match however, the cards would remain face up =/
mish




PostPosted: Wed Jan 17, 2007 10:18 pm   Post subject: RE:Concentration game =D

sooooooo..... anyone want to help me? >_> i'm really stuck =(
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: