Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: earlwood on Fri 11/07/2003 05:36:17

Title: Some sorta coursor trap...
Post by: earlwood on Fri 11/07/2003 05:36:17
']['oday I was working on my remake of Triplane Turmoil and I relised I that there simply wasn't enough views for some to steer the fightership to aim (it's a side scroller but with a plane). So , I thought of a mouse aiming idea. Is there anyway to lock a cursor into a certain area? This may be impossible :| but it has to constantly change..

To clear things up a bit I wanted the coursor to be trapped inside an invisble triangle so the player can't shoot backwards or stupidly through thier own plane :-)

Thanks In advance for reading my jumbled posting,
  Earlwood
Title: Re:Some sorta coursor trap...
Post by: Wolfgang Abenteuer on Fri 11/07/2003 05:44:09
Try SetMouseBounds.  Specify the left, top, right, and bottom boundaries for the mouse area, like such:

SetMouseBounds (80, 50, 240, 150);

for example will only allow the mouse cursor to move in a square in the middle of the screen.  This only makes squares, though, so you might have to do some more manipulating to make a triangle.

~Wolfgang
Title: Re:Some sorta coursor trap...
Post by: earlwood on Fri 11/07/2003 06:10:51
A square will do just fine...But is there anyway to make it follow the front of the character, and would it be possible to change the Cord. during certian views?
Title: Re:Some sorta coursor trap...
Post by: Wolfgang Abenteuer on Fri 11/07/2003 07:04:14
Well, I've never done anything like this myself so this is just a guess, but you could try using character variables in place for the coordinates.  Maybe something like:

SetMouseBounds ((character[EGO].x -50), (character[EGO].y -50), (character[EGO].x +50, (character[EGO].y +50));

which would, theoretically, create a 100x100 "box" around the player character and would follow him around wherever he goes (if put in the repeatedly execute section of the room script).

Edit:  And you should be able to change the bounds for each view as well.  I don't know if, by view, you mean character animation view, but if so then you could try:

if (character[EGO].view == 1) {
 SetMouseBounds(x, y, x, y);
}
else if (character[EGO].view == 2) {
 SetMouseBounds(x, y, x, y);
}

Again, I've never tried to do something like that myself so that's really just a guess.

~Wolfgang
Title: Re:Some sorta coursor trap...
Post by: earlwood on Fri 11/07/2003 08:15:09
ooh..ok I'll try it out tommorow..its 2:30am over here and I'm about to pass out. Thank you for the Hellava lot of help!