ForumsProgramming ForumHelp in a flash sniper game

65 20199
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
AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

This might not be the easiest way to do it, but it'll work. In the first frame of man1 add: dead = false; and in the final frame add: dead = true; Then, on the man1 MovieClip, set it to only play the man's death if dead == false.


For the crack, convert the building to a MovieClip and on it's actions add:

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

For ammo, create a variable for how much ammo you have left, and every shot decrease the variable by one, and only shoot if the ammo you have left is > 0

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

always ab that is a pro hehe <3

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

_root.getNextHighestDepth() does so the crack is on the top and not inside :P?

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

btw i think it should be
on(press)
{
var createcrack = _root.attachMovie("crack","crack", _root.getNextHighestDepth(), _root.getNextHighestDepth());
createcrack._y = _root.aim._y
createcrack._x = _root.aim._x
}

and if you got a mouse hide and a startdrag aim you should name it to your pointers name example:
createcrack._y = _root.arrow1._y
createcrack._x = _root.arrow1._x

so the arrow1 is my pointer (aim) ^^

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

wait, getNextHighestDepth() can not be that it is getting on the top because it is creating a crack where you click :P i am stupid now ^^

manny6574
offline
manny6574
922 posts
Nomad

thanx that helped a lot

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

No problem

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

no problem if i helped :P

manny6574
offline
manny6574
922 posts
Nomad

its ok

manny6574
offline
manny6574
922 posts
Nomad

I tried the dead=true thing but I either don't know how to set it to play when dead=false or it doesn't work???

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

It does work, I tested it.

To set it to play if dead is false, make the code for when you click on the man:

if(dead == false)
{
_root.man1.play();
}

manny6574
offline
manny6574
922 posts
Nomad

sorry I thought you did the double equals by mistake hehe

Voidcrystal
offline
Voidcrystal
138 posts
Nomad

haha no it's for conditions

manny6574
offline
manny6574
922 posts
Nomad

does anyone know how to get it to the winning frame when the stickman is dead? I tried doing it like this:

if(dead ==true) {
gotoAndStop(2);
}

but it didn't work. i'm so close to completion and getting really annoyed with trying out tons of ways of doing it

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Where did you put that?

Showing 1-15 of 65