Is there a way to set bounds for EVERYTHING?

Started by Uhfgood, Thu 05/07/2012 22:32:05

Previous topic - Next topic

Uhfgood

I would like to restrict everything to a certain area of the screen.  (Letterboxing purposes).  Without having to do each thing seperately.  Mouse position, objects, sprites, gui's you name it.

Is this possible?

Ghost

#1
You can restrict the mouse with mouse.SetBounds, effectively trapping the mouse in a rectangle it can never leave.
Mouse.SetBounds(int left, int top, int right, int bottom)
Restricts the area where the mouse can move on screen. The four parameters are the relevant pixel co-ordinates of that edge of the bounding rectangle. They are in the usual range (0,0) - (320,200).

Object and GUI positions are set manually anyways, so I am not sure what kind of automation you are looking for.

Khris

Yeah, we need a bit more details.
You can put a black, non-clickable GUI with a transparent area in the center on top of everything else, then limit the mouse to the inside like Ghost explained. That way everything is restricted to that area at least visually.
Objects and characters are usually bound to walkable areas anyway.
GUIs would disappear behind the black GUI if the latter has a higher zOrder.

Uhfgood

that's about the gist of it, mouse, objects, characters, and guis.  However since you can't seem to do this I will probably just live with what we have and restrict my guis to the scene area.  Thanks though.

Uhfgood

Quick question --- Why is the mouse bounds function restricted to 320x200 when you can have games that are larger?  As it seems I can't restrict my mouse position with that function (i'm running a 640x480 game)

Ghost

Quote from: Uhfgood on Fri 06/07/2012 04:41:18
Quick question --- Why is the mouse bounds function restricted to 320x200 when you can have games that are larger?

It isn't. I was quoting the manual, which often assumes people are using low-res. You can set the boundaries as you see fit, with your actual game resolution as the maximum.

Uhfgood

Apparently it doesn't work that way.  It yelled at me when when I tried to set it higher than 320x200.  Also when I set the coordinates to smaller it didn't seem to stop the mouse from going past it anyway.  I'm currently doing it manually.

Ghost

Quote from: Uhfgood on Fri 06/07/2012 05:46:14
Apparently it doesn't work that way.

That's odd. Can you provide some more information: Are you using a filter or a true 640x480 resolution? Do you have "use low-res cooridnates in scripts" on or off? And what exactly are you trying to achieve- create a large game window and using only a portion of it? Is it meant to be that way for the whole game, or just for a part of it? The more we know the better we can help ;)

Uhfgood

true 640x480, use low-res coordinates in scripts is false.

the game will happen in a 640x360 center box (letterbox)

Also see this other thread - (manually seems to be working btw) - http://www.adventuregamestudio.co.uk/yabb/index.php?topic=46366.0

SMF spam blocked by CleanTalk