STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228115
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5121

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/36390216?noj=FRM36390216-10DC" width="1" height="1"></div>

TheShooting Game Tutorial.swf

This is the info page for
Flash #59889

(Click the ID number above for more basic data on this flash file.)


Text
Starting off

Place a filled rectangle covering the whole
stage
Make the rectangle into a button named
‘hitarea’
Double-click on your new hitarea button.
Create a keyframe under ‘hit’ and remove the
content of the frames ‘up’, ‘over’ and ‘down’,
leaving the rectangle only on the hit frame.
This will be an invisible button which allow
the bullet holes to appear and the gunfire
sound to play.
On the main stage open the properties window
the for hitarea button and names its instance
name ‘hit1’

Next

HitArea

Back

Find or download the gunfire sound you want to play when the
mouse is clicked.
Import this gunfire sound to the library or stage.
If you cannot see the library window on the right hand side, on
the top menu go to window- library.
Right click on the audio file in the library and select "linkage".
Tick the "export for Actionscript" textbox and in the identifier
box, write "gunfire".
Lock the layer that the hit button is on and create another
layer and call it "code".
Open the actionscript window for the code layer/frame and
write the following code:

Gunfire Sound

// gunfire sounds
var gunfire = new Sound();
gunfire.attachSound("gunfire");
// When mouse is clicked, start sound
_root.hit1.onPress = function() {
gunfire.start();
}

The Gun Sights

Create another layer and
call it "sights".
Draw the sights of a gun
however you want.
Select the drawing and make
it into a movie clip named
‘gun’. In the instance box
for the gun movie clip also
write ‘gun’

Go to the "code" layer and input the following code under our previous one.

// initialise the movie
_root.onLoad = function() {
// hide the mouse
Mouse.hide();
};
// loop code
_root.onEnterFrame = function() {
//put cross hairs to mouse coords
_root.gun._x = _root._xmouse;
_root.gun._y = _root._ymouse;
};
Now test your game by pressing control + Enter. The sights should follow the mouse and gunfire sound play when you click. If this does not happen go back and check you have followed the instructions properly.

The bullet holes

Create a new layer named ‘bullet’ and draw a small circle.
Make it into a movie clip, also named ‘bullet’.
In the instance name textbox of the movie clip write ‘bull’. To make the bullet hole fade away go into it's movie clip, make it into a graphic and tween it's alpha from 100 to 0.
Write the following code into the actions of the bullet movieclip.
onClipEvent(load){
this._x = _root._xmouse;
this._y = _root._ymouse;
}
1.make sure it says"Actions - Movie Clip" at the top of the Actions window and not "Actions - Frame".

More Code

2.Now select The "code" layer, delete
the previous code and write:

var i;
// gunfire sounds
var gunfire = new Sound();
gunfire.attachSound("gunfire");
_root.hit1.onPress = function() {
gunfire.start();
i++;
//  create bullet holes
_root.bull.duplicateMovieClip("bulletNew", i);
if (i == 10) {
i = 0;
}
}; // initialise stuff
_root.onLoad = function() {
// hide the mouse
Mouse.hide();
};
//loop root.onEnterFrame = function() {
//put cross hairs to mouse coords
_root.gun._x = _root._xmouse;
_root.gun._y = _root._ymouse; };

Making the target

1.Make a new layer and call it
target.
2.On it, draw some sort of target.
Mine is simply a square with a face,
but yours can be whatever you want.
3.Select your target and make it
into a movieclip, In the instance
name textbox write ‘target_mc’.

My Target

Making the Blood

1.Go back to the gunsights movieclip and open it.
2.Create a second keyframe inside the movieclip and delete the contents of it.
3.In it’s place draw some kind of blood, or a picture of your target having been shot like mine.
4.Create another layer ,
5.On this layer make a keyframe on frame 1 and put the following code in:

stop();







var i;
// gunfire sounds
var gunfire = new Sound();
gunfire.attachSound("gunfire");
_root.hit1.onPress = function() {
gunfire.start();
i++;
// make bullet holes
_root.bull.duplicateMovieClip("bulletNew", i);
if (i == 10) {
i = 0;
}

continues onto
next page

Now we will make the target move across the
screen. Once again go back to the code layer on
the main stage and delete all the previous
actionscript. The following code is very long
and will take up 2 slides.
Use it to replace the previous one.

// hit test on target
if (_root.target_mc.hitTest(_root._xmouse, _root._ymouse, false)) {
// play explosion
_root.gun.gotoAndPlay(2);
// send target off stage
_root.target_mc._x = 0;
_root.target_mc._y = random(400); } };
// initialise stuff
_root.onLoad = function() {
// hide the mouse
Mouse.hide();
}; //loop
_root.onEnterFrame = function() {
//put cross hairs to mouse coords
_root.gun._x = _root._xmouse;
_root.gun._y = _root._ymouse;
// target move
_root.target_mc._x += 10;
// if it goes offstage, send it stage left
if (_root.target_mc._x<0 || _root.target_mc._x>Stage.width) { _root.target_mc._x = 0;
_root.target_mc._y = random(400); } };

Making a score counter

Create a new layer and name it ‘score’.
On this layer make a textbox big enough for 5 or 6 numbers. Open the properties window and make sure it is Dynamic text, and not input or static. In the ‘var’ box for the textbox write ‘total’.
Here are several ways to do the next bit but the way I made it work as to open your sights movie clip and go to the second frame with the blood. Write the following code into the actions for this frame:

_root.total = _root.total+100;

To prevent your score counter from
counting wrongly, go to the score
layer on the main stage and write the
code
total = 0;
Your simple shooting game should now
work properly. You can make yours much
better than mine by adding levels,
multiple targets better than mine by
adding levels, multiple targets,
backgrounds and making your targets
into movie clips.
I hope this has helped you
-Jethro

Press next to see my
finished basic shooting
game

Finishing

0

ActionScript [AS1/AS2]

Frame 2
stop();
Frame 3
stop();
Frame 4
stop();
Frame 5
stop();
Frame 6
stop();
Frame 7
stop();
Frame 8
stop();
Frame 9
stop();
Frame 10
stop();
Frame 11
stop();
Frame 12
stop();
Frame 13
stop();
Frame 14
stop();
Frame 15
stop();
Frame 16
stopAllSounds(); total = 0; Mouse.hide(); stop(); var i; var gunfire = new Sound(); gunfire.attachSound("gunfire"); _root.hit1.onPress = function () { gunfire.start(); i++; _root.bull.duplicateMovieClip("bulletNew", i); if (i == 10) { i = 0; } if (_root.target_mc.hitTest(_root._xmouse, _root._ymouse, false)) { _root.gun.gotoAndPlay(2); _root.target_mc._x = 0; _root.target_mc._y = random(400); } }; _root.onLoad = function () { Mouse.hide(); }; _root.onEnterFrame = function () { _root.gun._x = _root._xmouse; _root.gun._y = _root._ymouse; _root.target_mc._x = _root.target_mc._x + 10; if ((_root.target_mc._x < 0) || (_root.target_mc._x > Stage.width)) { _root.target_mc._x = 0; _root.target_mc._y = random(400); } };
Instance of Symbol 133 MovieClip "bull" in Frame 16
onClipEvent (load) { this._x = _root._xmouse; this._y = _root._ymouse; }
Instance of Symbol 133 MovieClip "bull" in Frame 16
onClipEvent (load) { this._x = _root._xmouse; this._y = _root._ymouse; }
Instance of Symbol 133 MovieClip "bull" in Frame 16
onClipEvent (load) { this._x = _root._xmouse; this._y = _root._ymouse; }
Instance of Symbol 133 MovieClip "bull" in Frame 16
onClipEvent (load) { this._x = _root._xmouse; this._y = _root._ymouse; }
Symbol 8 Button
on (press) { _root.play(); }
Symbol 9 MovieClip Frame 1
_root.stop(); PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100; if (PercentLoaded != 100) { setProperty(bar, _xscale , PercentLoaded); } else { gotoAndStop ("loaded"); }
Symbol 9 MovieClip Frame 2
gotoAndPlay (1);
Symbol 16 MovieClip Frame 30
stop();
Symbol 25 Button
on (press) { gotoAndPlay (3); }
Symbol 32 Button
on (press) { gotoAndPlay (2); }
Symbol 34 Button
on (press) { gotoAndPlay (4); }
Symbol 40 Button
on (press) { gotoAndPlay (3); }
Symbol 42 Button
on (press) { gotoAndPlay (5); }
Symbol 44 Button
on (press) { gotoAndPlay (4); }
Symbol 46 Button
on (press) { gotoAndPlay (6); }
Symbol 52 Button
on (press) { gotoAndPlay (5); }
Symbol 54 Button
on (press) { gotoAndPlay (7); }
Symbol 57 Button
on (press) { gotoAndPlay (6); }
Symbol 59 Button
on (press) { gotoAndPlay (8); }
Symbol 64 Button
on (press) { gotoAndPlay (7); }
Symbol 65 Button
on (press) { gotoAndPlay (9); }
Symbol 72 Button
on (press) { gotoAndPlay (8); }
Symbol 74 Button
on (press) { gotoAndPlay (10); }
Symbol 82 Button
on (press) { gotoAndPlay (9); }
Symbol 84 Button
on (press) { gotoAndPlay (11); }
Symbol 92 Button
on (press) { gotoAndPlay (12); }
Symbol 94 Button
on (press) { gotoAndPlay (10); }
Symbol 99 Button
on (press) { gotoAndPlay (13); }
Symbol 101 Button
on (press) { gotoAndPlay (11); }
Symbol 105 Button
on (press) { gotoAndPlay (12); }
Symbol 107 Button
on (press) { gotoAndPlay (14); }
Symbol 112 Button
on (press) { gotoAndPlay (15); }
Symbol 114 Button
on (press) { gotoAndPlay (13); }
Symbol 120 Button
on (press) { gotoAndPlay (16); }
Symbol 122 Button
on (press) { gotoAndPlay (14); }
Symbol 130 MovieClip Frame 1
stop();
Symbol 130 MovieClip Frame 2
_root.total = _root.total + 100;
Symbol 133 MovieClip Frame 40
stop();

Library Items

Symbol 1 Sound [gunfire]Used by:16
Symbol 2 GraphicUsed by:3
Symbol 3 MovieClipUses:2Used by:9
Symbol 4 GraphicUsed by:9
Symbol 5 GraphicUsed by:9
Symbol 6 GraphicUsed by:8
Symbol 7 GraphicUsed by:8
Symbol 8 ButtonUses:6 7Used by:9
Symbol 9 MovieClipUses:3 4 5 8Used by:Timeline
Symbol 10 GraphicUsed by:16
Symbol 11 GraphicUsed by:16
Symbol 12 GraphicUsed by:16
Symbol 13 GraphicUsed by:16
Symbol 14 GraphicUsed by:16
Symbol 15 GraphicUsed by:16
Symbol 16 MovieClipUses:10 11 12 1 13 14 15Used by:Timeline
Symbol 17 GraphicUsed by:Timeline
Symbol 18 FontUsed by:19 131
Symbol 19 EditableTextUses:18Used by:Timeline
Symbol 20 FontUsed by:21 22 23 29 30 37 38 47 49 50 55 61 66 68 69 70 76 77 78 87 88 96 97 102 103 109 110 116 117 118
Symbol 21 EditableTextUses:20Used by:Timeline
Symbol 22 TextUses:20Used by:Timeline
Symbol 23 TextUses:20Used by:25 34 42 46 54 59 65 74 84 92 99 107 112 120
Symbol 24 GraphicUsed by:25
Symbol 25 ButtonUses:23 24Used by:Timeline
Symbol 26 SoundUsed by:Timeline
Symbol 27 BitmapUsed by:28
Symbol 28 GraphicUses:27Used by:Timeline
Symbol 29 EditableTextUses:20Used by:Timeline
Symbol 30 TextUses:20Used by:32 40 44 52 57 64 72 82 94 101 105 114 122
Symbol 31 GraphicUsed by:32
Symbol 32 ButtonUses:30 31Used by:Timeline
Symbol 33 GraphicUsed by:34
Symbol 34 ButtonUses:23 33Used by:Timeline
Symbol 35 GraphicUsed by:Timeline
Symbol 36 GraphicUsed by:Timeline
Symbol 37 TextUses:20Used by:Timeline
Symbol 38 TextUses:20Used by:Timeline
Symbol 39 GraphicUsed by:40
Symbol 40 ButtonUses:30 39Used by:Timeline
Symbol 41 GraphicUsed by:42 65
Symbol 42 ButtonUses:23 41Used by:Timeline
Symbol 43 GraphicUsed by:44
Symbol 44 ButtonUses:30 43Used by:Timeline
Symbol 45 GraphicUsed by:46
Symbol 46 ButtonUses:23 45Used by:Timeline
Symbol 47 EditableTextUses:20Used by:Timeline
Symbol 48 GraphicUsed by:Timeline
Symbol 49 TextUses:20Used by:Timeline
Symbol 50 TextUses:20Used by:Timeline
Symbol 51 GraphicUsed by:52 64
Symbol 52 ButtonUses:30 51Used by:Timeline
Symbol 53 GraphicUsed by:54
Symbol 54 ButtonUses:23 53Used by:Timeline
Symbol 55 EditableTextUses:20Used by:Timeline
Symbol 56 GraphicUsed by:57
Symbol 57 ButtonUses:30 56Used by:Timeline
Symbol 58 GraphicUsed by:59
Symbol 59 ButtonUses:23 58Used by:Timeline
Symbol 60 GraphicUsed by:Timeline
Symbol 61 TextUses:20Used by:Timeline
Symbol 62 BitmapUsed by:63
Symbol 63 GraphicUses:62Used by:Timeline
Symbol 64 ButtonUses:30 51Used by:Timeline
Symbol 65 ButtonUses:23 41Used by:Timeline
Symbol 66 EditableTextUses:20Used by:Timeline
Symbol 67 GraphicUsed by:Timeline
Symbol 68 TextUses:20Used by:Timeline
Symbol 69 TextUses:20Used by:Timeline
Symbol 70 EditableTextUses:20Used by:Timeline
Symbol 71 GraphicUsed by:72
Symbol 72 ButtonUses:30 71Used by:Timeline
Symbol 73 GraphicUsed by:74
Symbol 74 ButtonUses:23 73Used by:Timeline
Symbol 75 GraphicUsed by:Timeline
Symbol 76 TextUses:20Used by:Timeline
Symbol 77 TextUses:20Used by:Timeline
Symbol 78 TextUses:20Used by:Timeline
Symbol 79 BitmapUsed by:80
Symbol 80 GraphicUses:79Used by:Timeline
Symbol 81 GraphicUsed by:82
Symbol 82 ButtonUses:30 81Used by:Timeline
Symbol 83 GraphicUsed by:84
Symbol 84 ButtonUses:23 83Used by:Timeline
Symbol 85 GraphicUsed by:Timeline
Symbol 86 GraphicUsed by:Timeline
Symbol 87 TextUses:20Used by:Timeline
Symbol 88 EditableTextUses:20Used by:Timeline
Symbol 89 BitmapUsed by:90
Symbol 90 GraphicUses:89Used by:Timeline
Symbol 91 GraphicUsed by:92
Symbol 92 ButtonUses:23 91Used by:Timeline
Symbol 93 GraphicUsed by:94
Symbol 94 ButtonUses:30 93Used by:Timeline
Symbol 95 GraphicUsed by:Timeline
Symbol 96 EditableTextUses:20Used by:Timeline
Symbol 97 TextUses:20Used by:Timeline
Symbol 98 GraphicUsed by:99
Symbol 99 ButtonUses:23 98Used by:Timeline
Symbol 100 GraphicUsed by:101
Symbol 101 ButtonUses:30 100Used by:Timeline
Symbol 102 TextUses:20Used by:Timeline
Symbol 103 EditableTextUses:20Used by:Timeline
Symbol 104 GraphicUsed by:105
Symbol 105 ButtonUses:30 104Used by:Timeline
Symbol 106 GraphicUsed by:107
Symbol 107 ButtonUses:23 106Used by:Timeline
Symbol 108 GraphicUsed by:Timeline
Symbol 109 TextUses:20Used by:Timeline
Symbol 110 EditableTextUses:20Used by:Timeline
Symbol 111 GraphicUsed by:112
Symbol 112 ButtonUses:23 111Used by:Timeline
Symbol 113 GraphicUsed by:114
Symbol 114 ButtonUses:30 113Used by:Timeline
Symbol 115 GraphicUsed by:Timeline
Symbol 116 TextUses:20Used by:Timeline
Symbol 117 TextUses:20Used by:Timeline
Symbol 118 TextUses:20Used by:Timeline
Symbol 119 GraphicUsed by:120
Symbol 120 ButtonUses:23 119Used by:Timeline
Symbol 121 GraphicUsed by:122
Symbol 122 ButtonUses:30 121Used by:Timeline
Symbol 123 GraphicUsed by:124
Symbol 124 ButtonUses:123Used by:Timeline
Symbol 125 GraphicUsed by:Timeline
Symbol 126 GraphicUsed by:127
Symbol 127 MovieClipUses:126Used by:Timeline
Symbol 128 GraphicUsed by:130
Symbol 129 GraphicUsed by:130
Symbol 130 MovieClipUses:128 129Used by:Timeline
Symbol 131 EditableTextUses:18Used by:Timeline
Symbol 132 GraphicUsed by:133
Symbol 133 MovieClipUses:132Used by:Timeline

Instance Names

"hit1"Frame 16Symbol 124 Button
"target_mc"Frame 16Symbol 127 MovieClip
"gun"Frame 16Symbol 130 MovieClip
"total"Frame 16Symbol 131 EditableText
"bull"Frame 16Symbol 133 MovieClip
"bull"Frame 16Symbol 133 MovieClip
"bull"Frame 16Symbol 133 MovieClip
"bull"Frame 16Symbol 133 MovieClip
"bar"Symbol 9 MovieClip Frame 1Symbol 3 MovieClip

Special Tags

Protect (24)Timeline Frame 10 bytes ""
ExportAssets (56)Timeline Frame 1Symbol 1 as "gunfire"
ExportAssets (56)Timeline Frame 1Symbol 1 as "gunfire"
ExportAssets (56)Timeline Frame 1Symbol 1 as "gunfire"
ExportAssets (56)Timeline Frame 1Symbol 1 as "gunfire"

Labels

"loaded"Symbol 9 MovieClip Frame 3

Dynamic Text Variables

totalSymbol 131 EditableText"0"




http://swfchan.com/12/59889/info.shtml
Created: 16/4 -2019 14:05:00 Last modified: 16/4 -2019 14:05:00 Server time: 10/05 -2024 09:53:09