Some sorta coursor trap...

Started by earlwood, Fri 11/07/2003 05:36:17

Previous topic - Next topic

earlwood

']['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

Wolfgang Abenteuer

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

earlwood

#2
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?

Wolfgang Abenteuer

#3
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

earlwood

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!

SMF spam blocked by CleanTalk