Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onClipEvent(load){
- timer = 0;
- i = 0;
- }
- onClipEvent(enterFrame){
- if(timer > 0){
- timer--;
- }
- if(Key.isDown(Key.LEFT)){
- _x -= 6;
- }else if(Key.isDown(Key.RIGHT)){
- _x += 6;
- }
- if(Key.isDown(Key.SPACE)){
- if(timer == 0){
- _root.attachMovie("bullet", "bullet"+i, _root.getNextHighestDepth());
- _root["bullet"+i]._x = _x;
- _root["bullet"+i]._y = _y-20;
- _root["bullet"+i].onEnterFrame = function(){
- this._y -= 10;
- if(this._y < -30){
- this.removeMovieClip();
- }
- for(k = 0; k < _root.enemies.length; k++){
- if(this.hitTest(_root[_root.enemies[k]])){
- _root.score += 10;
- this.removeMovieClip();
- _root[_root.enemies[k]].removeMovieClip();
- _root.enemies.splice(k, 1);
- }
- }
- }
- i++;
- timer = 20;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement