View Full Version : Sniper Rifle
kingofnukes
July 9th, 2005, 06:35 PM
Hi. I'm designing a 1st Person Shooter and I wanted to know if a sniper rife with a zoom feature is possible and if so what code to use for it.:cowboy:
signifer123
July 9th, 2005, 07:22 PM
of course it is jsut set the _yscale and _xscale of everything to higher than 1
kingofnukes
July 9th, 2005, 08:18 PM
what would the code be if i wanted it to zoom in when i hold down z and make the scope drag when you move the mouse?
Smee
July 9th, 2005, 09:36 PM
onEnterFrame = function(){
if(Key.isDown(Number(ord("Z")))){
Scope._x = _xmouse;
Scope._y = _ymouse;
}
}
Something like that, but the pathing would probably be different for your movie.
kingofnukes
July 9th, 2005, 09:52 PM
What do you mean pathing? (sorry I'm a noob)
nathan99
July 9th, 2005, 09:52 PM
And you cant have a footer that size r it will bem taken off of you
Smee
July 9th, 2005, 09:54 PM
Well, I mean the paths to the Scope and mouse. If you have the Scope MovieClip inside a MovieClip called Banana, which is inside a MovieClip called Spaghetti, then the "path" to Scope is "Spaghetti.Banana.Scope".
nathan99
July 9th, 2005, 09:54 PM
pathing..... writing the path to the object, for eg
_root.object1.object2.gotoAndStop();
//etc....
kingofnukes
July 9th, 2005, 09:56 PM
When I hold z it makes the scope move toward the mouse but it nothing gets bigger.
Is there a code similar to kirupas masking code tomake everythin it touches inlarge instead of showing a masked layer?
kingofnukes
July 9th, 2005, 09:56 PM
ok that's wat i thought it ment.
squishy
July 9th, 2005, 10:12 PM
hint hint footer to tall
kingofnukes
July 12th, 2005, 11:44 AM
Does anyone no a code or what? Im on a tight due date and I need that sniper done soon.
Smee
July 12th, 2005, 04:55 PM
Here is an example. The code is all in frame 1 of the "Actions" layer. The lines on the stage are just so you can see where the edge of the stage is when the background is covering it.
EDIT: Look two posts down
smack_boom
July 12th, 2005, 05:14 PM
or do you mean like:
if(Key.isDown(**whatever Z is**){
_root._xscale+=2
_root._yscale+=2
}
//put on any enterframe thingymajig
Smee
July 12th, 2005, 05:42 PM
Right on smack_boom! Here's the updated file with smooth aiming as he suggested.
Smee
July 12th, 2005, 07:21 PM
Press "z"
colombianking
July 12th, 2005, 07:28 PM
works now really nice
but before it didnt for me(-:
smack_boom
July 12th, 2005, 10:21 PM
OooOooOOoo i actually helped someone (-:
kingofnukes
July 13th, 2005, 06:05 PM
Thanx guys, your da best! :thumb2:
kingofnukes
July 13th, 2005, 08:38 PM
Since you guys helped me, I'll show you the finished engine for the sniper rifle.:beer:
colombianking
July 13th, 2005, 09:27 PM
the sniper should rotate with the mouse position
you should be able to shoot anywhere in the stage
and you should be able to die
also the enemy should regenerate in different spots
(sorry if picky , just tryig to give suggestions) :red:
kingofnukes
July 22nd, 2005, 09:49 PM
I just started programing the sniper rifle into my game and a problem came up. No matter how I size it, my background doesn't show up right on the preview. If the Mc is bigger than the screen, it will only show the corner of the Mc and if it's smaller than the screen it won't zoom. What's wrong with it. I had a diffrent pic before and it worked perfectly, but this one just doesn't want to work.
smack_boom
July 22nd, 2005, 10:38 PM
Maybe if you post the fla i could help?
kingofnukes
July 22nd, 2005, 11:06 PM
Here's the .fla
http://www.geocities.com/therealhellgame/zoom.fla
Blackspirit
July 23rd, 2005, 06:06 AM
You have to align your movieclip right.
In the background movieclip align the top left of the graphic to the middle point. Or just use the ctrl-k alignment panel to align to the left and top.
kingofnukes
July 23rd, 2005, 02:35 PM
Thanks. Now I can get back to work on my game. :hitman:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.