Using showimg for GUI elements
Make sure you do a changeimgvis index,4; where index is whatever index you are using for your showimg.
[QUOTE=Beholder]
screenwidth/2+32:
Place the image at the screen’s right edge (Ie: screen width, probably “640”)
Divided by 2 (think of folding the screen in half, the center of the screen. “320”)
Then Offset it +32 to the right (“320”* + 32 = “352”)
To place something at top left? 0,0
To place something top right? screenwidth-imagewidth,0
To place something bottom right? screenwidth-imgwidth,screenheight-imgheight
To place something bottom left? 0,screenheight-imgheight
[/QUOTE]
Other useful showimg operations associated with creation of guis:
In addition to showimg index,image,x,y;
-Crop pictures:changeimgpart index,startX,startY,width,height
-Show an animation:showani index,x,y,direction,gani,params;
–params can then be referred to within the gani(parameter numbers can range from 0-4)
—gani script:#p(0)
—in the gani editor:PARAM0
-overlay/change image layering:changeimgvis index,layer;4
–4+ use screen-coordinates, 0-3 are tile coordinates
Mouse operations:
-If (mousedown){
–will be true if the user clicks any button on their mouse, no loop of any sort is required
-if (mousewheel){
–this function is coupled with mousewheeldelta and is very useful for scrolling
This is for all future scripters not sure on how to create a gui
An example gui is:
if (playerenters){
showimg 300,plant.png,screenwidth/2,screenheight/2;
changeimgvis 300,4;
}
if (mousedown && mousescreenx in |screenwidth/2,screenwidth/2+32| && mousescreeny in |screenheight/2,screenheight/2+32|){
message you clicked it!;
}
Scroll Example:
if (mousewheel){
this.scroll += mousewheeldelta;
message #v(this.scroll);
}