Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: on Fri 27/02/2004 17:08:13

Title: Gun spy thingymabob...
Post by: on Fri 27/02/2004 17:08:13

I want to script a room that is kinda all darkness, except for one little spyhole the player can move about like a cursor. the player can see the backgroubd the spyhole.
This is going to be used as a kinda spying through a scope on a gun kinda thing. So if anyone could please help it would be greatly appreciated!
Title: Re:Gun spy thingymabob...
Post by: Moox on Fri 27/02/2004 17:45:58
the flashlight plugin might work
Title: Re:Gun spy thingymabob...
Post by: Scorpiorus on Fri 27/02/2004 17:52:25
Yep, check http://www.adventuregamestudio.co.uk/games.php?action=detail&id=187 ;)
Title: Re:Gun spy thingymabob...
Post by: on Fri 27/02/2004 18:54:31

I'm looking for a way without using plugins?
Title: Re:Gun spy thingymabob...
Post by: Alynn on Fri 27/02/2004 19:42:35
Well... this is my thought...

Have a HUGE black object with a spyhole (scope whatever) in the center of it Find out the X, Y coord difference between the center and the corner of the object (which I believe is the upper left corner, forgive me if I am wrong)

For instance if the object is at 0, 0 and your spyhole center is at 100, 100  and you click on say 150, 200

int moveX = mouse.x - (GetObjectX(OBJ) + 100);
int moveY = mouse.y - (GetObjectY(OBJ) + 100);
//at this point moveX is 50, and moveY is 100
MoveObjectDirect(OBJ, GetObjectX(OBJ) + moveX, GetObjectY + moveY, 3);

Doing it this way you will have to put the interaction on the object itself, and you won't be able to click on anything behind the keyhole.... You can also put it in your repeatedly execute and it will follow the mouse cursor...

The other possibility is a GraphicOverlay put the code in your repeatedly execute to follow the mouse cursor, using it on click won't work as well as the MoveOverlay is instant and not gradual like move Object....

Not tested, but the logic is right... (I believe)
Title: Re:Gun spy thingymabob...
Post by: MrColossal on Sat 28/02/2004 20:55:03
use an overlay instead of an object and it works better

experimenting with different sniper styles in 6DA i tried this and it worked wonderfully

just set moveoverlay to your mouse x and y in the rep execute and make sure the overlay image is at least two times as big as the background so that when you move all the way to the left, the right side doesn't pop out
Title: Re:Gun spy thingymabob...
Post by: AndersM on Mon 01/03/2004 17:51:37
Why not use the big bad black object as a character-view, and save all that scripting?