ForumsProgramming ForumI Need Help from a experienced programer.

6 3142
7432200
offline
7432200
134 posts
Nomad

Here is my script:

var keyListener:Object = new Object();
Key.addListener(keyListener);

keyListener.onKeyDown = function() {
if (Key.isDown(Key.UP)) {
spaceship._y -= 15;
} else if (Key.isDown(Key.DOWN)) {
spaceship._y += 15;
} else if (Key.isDown(Key.SPACE)) {
Shootlazer();
}
};


var intervalID = setInterval(ShootAlienlazer,5000);

function Shootlazer():Void {
mc = attachMovie("Lazer","Lazer"+getNextHighestDepth(),getNextHighestDepth());
mc._x = spaceship._x
mc._y = spaceship._y

}

function ShootAlienlazer():Void {
mc2 = attachMovie("laser","laser"+_root.getNextHighestDepth(),_root.getNextHighestDepth());
mc2._x = alien1.alien_shoot._x;
mc2._y = alien1.alien_shoot._y;

}
I need some one to tell me why it dose not work

  • 6 Replies
JustScott
offline
JustScott
96 posts
Nomad

i'd help you if i could but i've only learnt the basics... good luck with it

Diddy645
offline
Diddy645
23 posts
Nomad

Try to comment things out slowly, piece by piece, and add a bunch of trace statements. That is how I solve all of my problems. Almost no one will be able to help you without seeing what is going wrong.

plasmafish
offline
plasmafish
252 posts
Nomad

Before someone fixes it people need to know what the code does. Just because an experienced programmer can read code does not mean he wants to have to read every single line to understand what your code does. Flash code is not just cut and paste in all situations so unless you describe exactly what the code is doing and what it is for then you will never get a good answer. If you tell people what you are trying to do then they can replicate it themselves to test it and see if they can get your code to work.

Are you sure this code is the best way to achieve what you are trying to do?

7432200
offline
7432200
134 posts
Nomad

Ok... people just to be clear. im makeing a game were you are a spaceship and you need to kill aliens, kind of like space invaders but different. but the aliens dont shoot back.

7432200
offline
7432200
134 posts
Nomad

I figured out why the aliens dont shoot back but they dont kill you can someone tell me how to make them kill you.

plasmafish
offline
plasmafish
252 posts
Nomad

You are not receiving replies to this because you posted a piece of code instead of all the supporting code also.

You still didn't even tell anyone what the code attaches to. I'm guessing this code goes on the frame itself and controls the movie clips? I have no clue man, you will never figure it out if you play it off like you are programming some secret military project. It's just a flash game, you need to post more information about what you are doing and how you are doing it. There is thousands of ways to program a flash game and the way that you picked may be problematic.

Showing 1-6 of 6