# Action script

**URL:** <https://forum.kirupa.com/t/action-script/2774>\
**Category:** flash\
**Created:** [April 17, 2002, 2:27am UTC](https://forum.kirupa.com/t/action-script/2774 "2002-04-17T02:27:40Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [April 17, 2002, 2:27am UTC](https://forum.kirupa.com/t/action-script/2774/1 "2002-04-17T02:27:40Z")

</div>

Oki doki.\r\rHere’s my problem.\r\rI’ve created my first little game [lame-o ship-shooter thingy], and I have all the actions working fine for the most part, what I need help with is some code to do this:\r\rWhen the spaceship movie clip moves up, the enemy movie clip should move up as well [follows the spaceship up/down]… it’s probably simple, but my attempts, well yeah. This probably isn’t enough info, but it’s worth a shot!\r\rThanks.

---

<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:** [April 17, 2002, 5:40am UTC](https://forum.kirupa.com/t/action-script/2774/2 "2002-04-17T05:40:12Z")

</div>

put an onclip(enter frame) on the ennemy that checks the spaceships \_y all the time in an if-clause, and if it changes, modifies its own \_y too.

---

<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:** [April 17, 2002, 8:52am UTC](https://forum.kirupa.com/t/action-script/2774/3 "2002-04-17T08:52:33Z")

</div>

Be careful though… if the enemies objective is to crash into the player’s ship, you’ll be right on the money… but if the players objective is to avoid the enemy, he wont be able to do so.\r\rEnemy movement is very tough in games, I’m finding. I created a pong game (my first real game in flash) and my computer controled opponant NEVER misses the pong ball. It’s great for training, but it’s very frustrating…
