Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: thecatamites on Mon 07/09/2009 22:51:31

Title: trouble with gui coordinates
Post by: thecatamites on Mon 07/09/2009 22:51:31
Hello,
I'm trying to implement a kind of visible timer in a game I'm working on; that is, a thin horizontal bar stretching the whole length of the screen while a small sprite moves to the left every few seconds. Here's a picture:

(http://img268.imageshack.us/img268/3562/barct.jpg)

I did it by making the bar and the cursor both seperate GUIs, setting them on top of each other, and using a small script for the movement. The movement part works fine, but I want to have the cursor GUI start at the very right-hand edge of the screen; at the moment if I set the x-coordinate to anything above 319 it says it's out of range but if I set it less it comes up too short, starting at the position in the picture. The game is 800x600, and I used the 400x300-res coordinates for the bar GUI and it worked out fine, but I can't get the bar GUI where I want it!

I'm sure there's an obvious reason I'm missing but at the moment i got nothin  :P
Thanks!
Title: Re: trouble with gui coordinates
Post by: Ryan Timothy B on Mon 07/09/2009 22:59:30
Anything above 319 sounds like you're using low res coordinates with a 640 width screen?  I honestly don't know.

But one thing you could think about doing instead of a GUI on top of another GUI for the marker.  Just place a button in the GUI, with a graphic, and move it around with the buttons X coordinates.
Title: Re: trouble with gui coordinates
Post by: thecatamites on Mon 07/09/2009 23:24:07
Ah, that works perfectly, thank you! I knew there was some better way to do it but GUIs are still kind of a closed book to me for the most part  ;D
Title: Re: trouble with gui coordinates
Post by: tzachs on Mon 07/09/2009 23:25:19
The GUI you are describing is a Slider. Simply create a new GUI, add a slider, change the background image and the handle (you called it cursor) image, select the min & max values, and then set the slider value to the max value.