A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Advanced Sniper Scope Help

  1. #1
    Member
    Join Date
    Oct 2002
    Posts
    67

    Advanced Sniper Scope Help

    Hi,

    I have been working on this game for the past few days.

    Am am trying to make a realistic advanced sniper rifle, but I am encountering some problems.

    First and foremost is the zooming issue. So far everything I have seen reguarding zooming has been tricks using multiple images and masking.

    However, with this scope I wish to keep the magnified area stationary and to have the area being focused be the mouse tip. (I also wish to "slow down" the mouse movement when the scope is up to make it harder to move the rifle)

    How can I acheive this effect?

    Play with the SWF and tell me what you think.

  2. #2
    Hum...Can't think of one yet goodnightall's Avatar
    Join Date
    Jun 2003
    Location
    Hong Kong
    Posts
    107
    Can you provide the fla?
    Yours faithfully,
    lemontea
    (Did you realize that my avatar was made by flash? No? Well...)

  3. #3
    Member
    Join Date
    Oct 2002
    Posts
    67
    I would provide the FLA, but it is really pointless.

    The file only consists of a clip event telling the rifle to follow the mouse, and a button that says _root.rifle.gotoAndPlay(2) and with a done/not done sequence.

    So the file is really bare bones.

    The only reason I attached the SWF was just to show people what I am trying to acheive. I am trying to acheive a stationary magnifying glass while having the point of focus be the mouse.

  4. #4
    Hum...Can't think of one yet goodnightall's Avatar
    Join Date
    Jun 2003
    Location
    Hong Kong
    Posts
    107
    In fact I'm trying to , if provided the fla , to really WORKS on it.(I don't really like just pasting the code here since I'm newbie and made quiet a lot of mistake,I mostly solve a problem by constantly trail and errors,so using a given fla and act as if athe devloper of this would make me really LEARN from others error)
    Back to your question.I think making the focus stay at centre isn't hard,as I've seem example of this,but slowing the movement of mouse would be rather diffcult.
    Yours faithfully,
    lemontea
    (Did you realize that my avatar was made by flash? No? Well...)

  5. #5
    Hum...Can't think of one yet goodnightall's Avatar
    Join Date
    Jun 2003
    Location
    Hong Kong
    Posts
    107
    Sorry but I don't think it would be possible to keep the "zoomer" at the centre AND make the mouse always be the focused point.Because this would mean you have to FORCE the mouse to stay at it old position and the mouse pointer can't leave anymore.(Nor did flash able to force the mouse pointer stay).
    So I guess it would only be possible to let the zoomer stay at the center while the mouse pointer can move,but the focus point won't be at the mouse pointer but center(nor will the mouse pointer be shown)
    Yours faithfully,
    lemontea
    (Did you realize that my avatar was made by flash? No? Well...)

  6. #6
    Moderator
    FK Junkie
    TiefighT's Avatar
    Join Date
    Aug 2000
    Posts
    683
    Well, if you want a reallistic looking blur, you could create a seperate raster image for each object on the screen (bad guys, major parts of buildings, etc.). This seperate image will be identicle to the flash objects, but will have a blur on it (can do it using photoshop, paint shop pro, whatever). Now you import this image, and lay it over the top of your in-focus guy in flash, and as your mouse moves you calculate the distance to the mouse, and set the alpha on the blurred image as appropriate (the closer the mouse, the lower the alpha).

    Downside is that it will tend to be slow as mollases and bloat the file size, but you should be able compress the blurred images quite a bit without any real quality loss, and then should be able to optomize the code some once you get it working.

    I did something very similar for a friend's website once, but can't seem to find the .swf or .fla anywhere :/. I'll let you know if I do.

    Edit: Found an example image from that website. I apparently did it backwards of what I told you, a big, blurred background, with in-focus foreground pictures that alphad in and out. Click here to see the example image.
    Last edited by TiefighT; 07-18-2003 at 12:26 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center