
-----------------------------------
mish
Wed Jan 17, 2007 6:27 pm

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.

-----------------------------------
Prince Pwn
Wed Jan 17, 2007 6:34 pm

Re: Concentration game =D
-----------------------------------
When you click the button there is a procedure that is called. So if you have a variables like:

var number1 : int

Then when you click the button, inside your procedure go:

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:

put number1

or

Font.Draw (intstr (number1), 50, 100, defFontID, brightred)


-----------------------------------
mish
Wed Jan 17, 2007 6:42 pm

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
Wed Jan 17, 2007 6:50 pm

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
Wed Jan 17, 2007 10:18 pm

RE:Concentration game =D
-----------------------------------
sooooooo..... anyone want to help me? >_> i'm really stuck =(
