# Game Actionscript

**URL:** <https://forum.kirupa.com/t/game-actionscript/30013>\
**Category:** flash\
**Created:** [September 2, 2003, 11:10pm UTC](https://forum.kirupa.com/t/game-actionscript/30013 "2003-09-02T23:10:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nemonin](https://avatars.discourse-cdn.com/v4/letter/n/34f0e0/32.png) [@Nemonin](https://forum.kirupa.com/u/Nemonin)\
**Post date:** [September 2, 2003, 11:10pm UTC](https://forum.kirupa.com/t/game-actionscript/30013/1 "2003-09-02T23:10:35Z")

</div>

I was wondering if you could help me with something. I am trying to make a game where you have random objects falling vertically and must land in a bucket. The bucket is controlled by the mouse(it follows the mouse). I have not yet found an appropriate script to perform this action. Please help me out, that would mean a lot to me. Thanks

---

<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:** [September 2, 2003, 11:26pm UTC](https://forum.kirupa.com/t/game-actionscript/30013/2 "2003-09-02T23:26:37Z")

</div>

if you are duplicating the falling thing put in the mc

```auto
if(_parent.hitTest(_root.basket)) {
_parent._visible = false;
_root.score += 1;
}

```

thats how you get them to disappear and add to the score when they hit the basket.

```auto
onLoad = function() {
this._x = random(400);
//change 400 to the width of the stage
}

```

that makes them appear in random spots

```auto
onClipEvent(enterframe) {
this._x = _root.xmouse;
}
}

```

this makes the bucket follow the mouse

wasn’t sure what you were asking, so i answered most everything you stated you were going to do…

---

<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:** [September 3, 2003, 12:35am UTC](https://forum.kirupa.com/t/game-actionscript/30013/3 "2003-09-03T00:35:04Z")

</div>

```auto
if(_parent.hitTest(_root.basket)) {
_parent._visible = false;
_root.score++ //jingman changed to ++;
}

```

```auto
onLoad = function() {
this._x = Math.random()*(Stage.width);
//jingman changed '400' to Stage.width
}

```

```auto
onClipEvent(enterframe) {
this._x = _root._xmouse; // jingman changed to _xmouse
}

```

Just cleaned it a bit, hope that’s cool Yeldarb.

---

<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:** [September 3, 2003, 12:45am UTC](https://forum.kirupa.com/t/game-actionscript/30013/4 "2003-09-03T00:45:41Z")

</div>

yeah, that should be \_xmouse, shouldn’t it 🙂 lol missed that when i re read through my post

no prob, mess with it as you please 🙂

---

<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:** [September 4, 2003, 10:39pm UTC](https://forum.kirupa.com/t/game-actionscript/30013/5 "2003-09-04T22:39:29Z")

</div>

The reply you gave was good untill the hit testing. I don’t know if it has to do with the score or anything. If you could give me a working script for hit testing without a score that would be great thanks.

---

<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:** [September 5, 2003, 12:31am UTC](https://forum.kirupa.com/t/game-actionscript/30013/6 "2003-09-05T00:31:52Z")

</div>

just take the score line out  
if you could post the .fla, that would help too
