ForumsProgramming ForumHelp in a flash sniper game

65 20198
manny6574
offline
manny6574
922 posts
Nomad

please help in my first proper game in flash. The problem is that when you shoot the man he dies but once he's shot and you shoot him again he comes back alive and you can shoot him again. also I don't know how to make ammo and i want to use it. another problem is i don't know how to make the bullet do a crack in the building if it is shot. the crack image is the 'crack' symbol in the library. if you'd like to take a look at the thing then here's the download:

.fla: [url=http://www.mediafire.com/?uzdzugoznm2]

.swf: [url=http://www.mediafire.com/?nmz1mjtwa3i]

hope someone can help. also, im a beginer so if you could explain the actionscript then that would help. thanks

  • 65 Replies
manny6574
offline
manny6574
922 posts
Nomad

first on the frame then on the movie clip man1

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Ok, leave it on the movie clip and change gotoAndStop(2); to _root.gotoAndStop(2);

manny6574
offline
manny6574
922 posts
Nomad

doesn't work and I forgot to say that it needs an onClipEvent and i made it (load) and then (enterFrame) none worked, even with _root.

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Strange...On the last frame of the man, add _root.gotoAndStop(2);

manny6574
offline
manny6574
922 posts
Nomad

no didn't work

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Use _root.gotoAndPlay(2); instead, sorry.

manny6574
offline
manny6574
922 posts
Nomad

at last! it works! thanks a lot. all I need to do now is improve the graphics and make more missions

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

No problem. Good luck with the rest of your game

manny6574
offline
manny6574
922 posts
Nomad

unfortunately here's some bad luck the cracks stay the for the rest of the mission completed screed and continue to be there in the briefing of the next mission

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

do something like

_root.gotoAndPlay(2);
delete this.onEnterFrame;

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

or

_root.gotoAndPlay(2);
delete crack.onEnterFrame;

manny6574
offline
manny6574
922 posts
Nomad

it doesn't work

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

but you have to put it under the crack spawn

manny6574
offline
manny6574
922 posts
Nomad

if i put it under the spawn then this happens:

on(press){
var createCrack = _root.attachMovie("crack","crack", _root.getNextHighestDepth(), _root.getNextHighestDepth());
createCrack._y = _root.aim._y
createCrack._x = _root.aim._x
}
_root.gotoAndPlay(2);
delete crack.onEnterFrame;

**Error** Scene=Scene 2, layer=lvl, frame=1:Line 6: Statement must appear within on/onClipEvent handler
_root.gotoAndPlay(2);

**Error** Scene=Scene 2, layer=lvl, frame=1:Line 7: Statement must appear within on/onClipEvent handler
delete crack.onEnterFrame;

if i put it in it:

on(press){
var createCrack = _root.attachMovie("crack","crack", _root.getNextHighestDepth(), _root.getNextHighestDepth());
createCrack._y = _root.aim._y
createCrack._x = _root.aim._x
_root.gotoAndPlay(2);
delete crack.onEnterFrame;
}

...then when i shoot the building it goes to the winning screen
have a look because it's changed a lot

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Great improvements on the game!

To fix the cracks problem, on the building, add:

onClipEvent(load)
{
cracks = [];
}
and right after creating the crack add: cracks.push(createCrack);

This way you can refer to all the cracks through the variable "cracks"
So, on the frame where you go to the win screen add:

for(var i in _root.building1.cracks)
{
_root.building1.cracks[i].removeMovieClip();
}

Showing 16-30 of 65