# Generating Arrows

**URL:** <https://forum.kirupa.com/t/generating-arrows/749>\
**Category:** flash\
**Created:** [July 29, 2002, 2:43am UTC](https://forum.kirupa.com/t/generating-arrows/749 "2002-07-29T02:43:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wes321](https://avatars.discourse-cdn.com/v4/letter/w/96bed5/32.png) [@wes321](https://forum.kirupa.com/u/wes321)\
**Post date:** [July 29, 2002, 2:43am UTC](https://forum.kirupa.com/t/generating-arrows/749/1 "2002-07-29T02:43:27Z")

</div>

When I’m making the DDR Game i want it to have the arrows randomly go up the screen and when it gets to a certain area i want to press a key and get only 5 points. If you know how to make random movie clips come up plz tell me and if you know how to make it so when it gets to a spot to enable keys to be pressed for points.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 29, 2002, 8:01am UTC](https://forum.kirupa.com/t/generating-arrows/749/2 "2002-07-29T08:01:29Z")

</div>

I’m not sure what you’re saying in the second part, but I can tell you how to have something apear randomly at the bottem of the screen and move up the screen.

Create a movie clip arrow and attach the following code to the outside of the clip.

Assuming the movie width is 600 pixels.

onClipEvent(load){  
//change the 600 in this formula to the width of the movie.  
location=Math.random()\*600+1;  
//this is assuming you want a random velocity. Change the 4 to  
//whatever will work best for the velocity, or take the random  
//code out and just assign a velocity, if you would prefer it  
//remain the same.  
velocity=Math.random()\*4+1;  
}

onClipEvent(enterFrame){  
//this just says, every time this movie clips timeline changes  
//frames, do this.  
\_y-=velocity;  
}

Something like this, would set it up to do something once it’s height got to less than 40 pixels from the top of the screen.

onClipEvent(enterFrame){  
//this just says, every time this movie clips timeline changes  
//frames, do this.  
\_y-=velocity;  
if(\_y\<40){  
this.keyboardTrip=true;  
}else{  
this.keyboardTrip=false;  
}  
}

The variable keyboardTrip could then be used by other movie clips to detect and interact with the clip.

Could you explain a little more what it is you’re looking to have the arrow do once it reaches a certain height?
