
-----------------------------------
sammy101
Tue Jan 18, 2005 6:46 pm

variable meaning??
-----------------------------------

procedure drawbuttons
    drawbox (39, maxy - 116 - sub, 261, maxy - 64 - sub, black)
    drawfillbox (40, maxy - 115 - sub, 260, maxy - 65 - sub, 30)
    drawfillbox (45, maxy - 110 - sub, 255, maxy - 70 - sub, 27)
    Draw.Text (names (b), 50, maxy - 100 - sub, font, 34)
end drawbuttons
Can anyone please tell me what the variable sub in the procedure above is/does in this case?
oh and as well as the "names (b) part

-----------------------------------
xHoly-Divinity
Tue Jan 18, 2005 6:53 pm


-----------------------------------
It does nothing because it has not been 'declared.' You would have to put something like var sub, names : int

Or in your procedure you would have to put

procedure blah (sub, names : int)
code 
code
code
end blah


then when you recall it, you would go


blah (x, y)
%You can put any values you want for x and y


-----------------------------------
basketball4ever
Tue Jan 18, 2005 6:55 pm


-----------------------------------
if ur talking about maxx and maxy... thats not a variable... i believe its the max : P not really a variable... like if ur max pixels on ur window is 60... then the maxx is 60 something like that...
and as for the names... it does nothing

-----------------------------------
Bacchus
Tue Jan 18, 2005 7:02 pm


-----------------------------------
accually i think he was talking about the variables sub and names :P not maxy, basically just geussing at the variables and thing. it draws a outline of a box with a filld box inside with another filled box inside of that, and then outputs something under the variables names

-----------------------------------
sammy101
Tue Jan 18, 2005 7:25 pm


-----------------------------------
yea i think what bacchus said is right
here's another part of the same program,its basically piece of a car racing game 

randint 
(add, 5, 10)
drawfillbox (position(1), 0, position(1)+100, 100, white)
Pic.Draw (car1, position (1) + add, 0, 0)
position (1) := position (1) + add
drawline (maxx - 100, maxy, maxx - 100, 0, black)
delay (25)
if position (1) >= maxx - 100 then
cls
Pic.Draw (car1, maxx div 2, maxy div 2, 0)
check := "1"
exit
end if
its supposed to animate car1 and move it accross a screen,can someone please explain the randint(add,5,10)part and how do you determine the speed it moves across the screen???

-----------------------------------
Bacchus
Tue Jan 18, 2005 7:46 pm


-----------------------------------
randint(add,5,10) assigns a random integer between 5 and 10 (ex. 5, 6, 7, 8, 9, 10) and the speed of the car is accually in that part. the position(1) array/var/thingy (watever you want to call it) is the current position of the car and then the add var (now a random number between 5 and 10) is added to it when the car is drawn and then its permently added to the var. (really they could have added it to the var earlier and skiped the +add in the drawpic) thats what causes the movement, im also guessing that the bit u poasted is in a loop somewhere
