Just thought I would give some of my simple functions away that might come in use to you all.
Right now, I'm only adding a few, but I will go through adding as many as I can each day or so
The Text Button.
Syntax:
THE GLOBALS GO ABOVE YOUR PROGRAM!
x = x position.
y = y position.
Text$ = Words.
Normal, Over, Back = color for text. Specify each with the 'rgb()' command.
The Function:
global pressed : global released
function button(x,y,Text$,normal,over,back)
if mousex()>x-(text width(Text$)/2) and mousex()<x+(text width(Text$)/2) and mousey()>y-(text height(Text$)/2) and mousey()<y+(text height(Text$)/2)
ink over,back
if mouseclick()=1 then pressed=1
else
ink normal,back
endif
if pressed=1 and mouseclick()=0 then released=1
center text x,y,Text$ : set text opaque
endfunction released
Example:
global pressed : global released
Sync On
Do
if button(screen width()/2,100,"Test1",rgb(0,0,255),rgb(255,0,0),rgb(255,255,255)) then cls : end
if button(screen width()/2,130,"Test2",rgb(0,0,255),rgb(255,0,0),rgb(0,0,0)) then cls : end
Sync
Loop
function button(x,y,Text$,normal,over,back)
if mousex()>x-(text width(Text$)/2) and mousex()<x+(text width(Text$)/2) and mousey()>y-(text height(Text$)/2) and mousey()<y+(text height(Text$)/2)
ink over,back
if mouseclick()=1 then pressed=1
else
ink normal,back
endif
if pressed=1 and mouseclick()=0 then released=1
center text x,y,Text$ : set text opaque
endfunction released
The Free Functions
(If you don't want to have to specify all of your objects with numbers)
Syntax:
Variable=FreeObj()
THAT GOES FOR EVERY OTHER FUNCTION TOO!
Function(s):
function FreeObj()
repeat
inc n
until object exist(n)=0
endfunction n
function FreeImg()
repeat
inc n
until image exist(n)=0
endfunction n
function FreeSnd()
repeat
inc n
until sound exist(n)=0
endfunction n
function FreeMsc()
repeat
inc n
until music exist(n)=0
endfunction n
function FreeEfct()
repeat
inc n
until effect exist(n)=0
endfunction n
Example:
Sync On
Player=FreeObj()
Make Object Cube Player,5
Fighter=FreeObj()
make Object Sphere Fighter,4
Move Object Right Fighter,6
Move Camera -10
Do
Center text object screen x(Player),object screen y(Player),"Player"
Center text object screen x(Fighter),object screen y(Fighter),"Fighter"
Sync
Loop
function FreeObj()
repeat
inc n
until object exist(n)=0
endfunction n
The 'Real' Wait Key
Syntax:
This 'Wait Key' actually waits for any key instead of just the functioned ones.
Just put WaitKey() anywhere you want it to work.
Function:
function WaitKey()
repeat
until scancode()>0
if scancode()>0
repeat
until scancode()=0
endif
endfunction
Example:
Print "Test1, Press any key"
WaitKey()
Print "Test2, you pressed a key, press another key to end"
WaitKey()
cls
end
function WaitKey()
repeat
until scancode()>0
if scancode()>0
repeat
until scancode()=0
endif
endfunction
Well, thats what I have so far. I'll cook up some more later
Applyby has Flies in his Eyes.