# Help with acitonscript code

**URL:** <https://forum.kirupa.com/t/help-with-acitonscript-code/160039>\
**Category:** Uncategorized\
**Created:** [August 22, 2005, 11:47pm UTC](https://forum.kirupa.com/t/help-with-acitonscript-code/160039 "2005-08-22T23:47:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icehawk](https://avatars.discourse-cdn.com/v4/letter/i/51bf81/32.png) [@Icehawk](https://forum.kirupa.com/u/Icehawk)\
**Post date:** [August 22, 2005, 11:47pm UTC](https://forum.kirupa.com/t/help-with-acitonscript-code/160039/1 "2005-08-22T23:47:52Z")

</div>

[size=1]hi k i got the code working fine now[/size]  
[size=1]but there is a few minor things i tried to add[/size]  
[size=1][/size]  
[size=1]im trying to make it so that you only have a certain amount of bullets/arrows left [/size]  
[size=1]so i have an imput text field blank with an instance name al[/size]  
[size=1]would i not use al=12 for the starting amount of bullets???[/size]  
[size=1]as show below and then[/size]  
[size=1]\_root.al-=1; to take a arrow/bullet away after its hit?[/size]  
[size=1][/size]  
[size=1]another question is there somthing else i can use instead of alpha [/size]  
[size=1]because the target goes away so it looks like you hit it but u can hit it again and score extra points which i dont want.[/size]  
[size=1]so is there a way to delete it or somthing like that after its hit???[/size]  
[size=1][/size]  
[size=1]lastly at the bottom the code makes it go to the next scene after all targets are hit…[/size]  
[size=1]is there way to make it so it goes to next scene after target 1-6 are hit[/size]  
[size=1]6-8 are optional so kinda like this[/size]  
[size=1][/size]  
[size=1]if target 1-6 are hit then go to scene 2[/size]  
[size=1]but if targets 1-6+7 also go to scene 2[/size]  
[size=1][/size]  
[size=1]target1-6 are 10+ pts[/size]  
[size=1]target7-8 are 20- pts[/size]  
[size=1][/size]  
[size=1]ty for ne 1 who helps 🙂 :o i thinking im understanding programming in flash just not fully im learning fast from u all :)[/size]

[size=1]CODE[/size]  
[size=1]----------  
onClipEvent(load){  
xpos=\_x;  
ypos=\_y;  
moving=false;  
xmax=-10;  
movespeed=7;  
al=12  
}  
onClipEvent(enterFrame){  
if(\_root.arrow.hitTest(\_root.balloon1)){  
\_root.balloon1.\_visible=false;  
\_root.al-=1;  
\_root.total+=10;  
}  
if(\_root.arrow.hitTest(\_root.balloon2)){  
\_root.balloon2.\_visible=false;

```
            _root.total-=20;
    }

```

if(\_root.arrow.hitTest(\_root.balloon3)){  
\_root.balloon3.\_visible=false;

```
            _root.total-=20;
    }

```

if(\_root.arrow.hitTest(\_root.balloon4)){  
\_root.balloon4.\_visible=false;

```
            _root.total+=10;
    }

```

if(\_root.arrow.hitTest(\_root.balloon5)){  
\_root.balloon5.\_visible=false;

```
            _root.total+=10;
    }

```

if(\_root.arrow.hitTest(\_root.balloon6)){  
\_root.balloon6.\_visible=false;

```
            _root.total+=10;
    }

```

if(\_root.arrow.hitTest(\_root.balloon7)){  
\_root.balloon7.\_visible=false;

```
            _root.total+=10;
    }

```

if(\_root.arrow.hitTest(\_root.balloon8)){  
\_root.balloon8.\_visible=false;

```
            _root.total+=10;
    }
    if(Key.isDown(Key.SPACE)){
            moving=true;
    }
    if(moving){
            _x-=movespeed;
    }
    if(_x&lt;ymax){
            moving=false;
            _x=xpos;
            _y=ypos;
            if(_root.balloon1._visible==false && _root.balloon2._visible==false && _root.balloon3._visible==false && _root.balloon4._visible==false && _root.balloon5._visible==false && _root.balloon6._visible==false && _root.balloon7._visible==false && _root.balloon8._visible==false){
                    _root.gotoAndStop("s4");
            }
    }

```

}[/size]
