# Need help with game

**URL:** <https://forum.kirupa.com/t/need-help-with-game/185922>\
**Category:** jobs\
**Created:** [April 17, 2006, 6:48pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922 "2006-04-17T18:48:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ari](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Ari](https://forum.kirupa.com/u/Ari)\
**Post date:** [April 17, 2006, 6:48pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/1 "2006-04-17T18:48:05Z")

</div>

I made a platforms game but it needs some extras. Does anyone know how to add coins?

---

<div class="post-metadata">

**Author:** ![Joppe](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@Joppe](https://forum.kirupa.com/u/Joppe)\
**Post date:** [April 17, 2006, 7:58pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/2 "2006-04-17T19:58:21Z")

</div>

Are you serious? Sorry for me being rude but you got to post some indepth description or code/fla. Please think about this next time you post. And this time…

---

<div class="post-metadata">

**Author:** ![ricer](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@ricer](https://forum.kirupa.com/u/ricer)\
**Post date:** [April 17, 2006, 8:45pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/3 "2006-04-17T20:45:42Z")

</div>

ok i dont know what u mean exacly but i hope i under stand u ok

u want to make money system? 😛

ok i hope thats it cause thats what ill teach u

1. create a “Dynamic text box” and call it money
2. draw a coin and make it a movie clip (no matter what u call it)

now give the coin these actions:

```auto
 onClipEvent(enterFrame){
       if (_root.charname.hitTest(this)){
       _root.money += 1;
      this._x = -500;
      this._y = -500;
      }
      }

```

now put this action in the frame:

```auto

_root.money = 0;

```

and that should be it 🙂

---

<div class="post-metadata">

**Author:** ![Nich](https://avatars.discourse-cdn.com/v4/letter/n/e79b87/32.png) [@Nich](https://forum.kirupa.com/u/Nich)\
**Post date:** [April 18, 2006, 12:32pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/4 "2006-04-18T12:32:13Z")

</div>

That might work for a short game, but in a long one keeping the coins around like that might cause trouble. I suggest making a function called loadCoins that uses attachMovie() to load it from the library. Then unloadMovie() when you hitTest it. Look up those three functions (attachMovie, unloadMovie, hitTest), and then come back if you need help.

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [April 18, 2006, 1:05pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/5 "2006-04-18T13:05:14Z")

</div>

yeah… tho, Nich, not sure about needing a function… or to load them, or needing to call it loadCoins.

try, labelling all coins, coin0, coin1 etc…  
if you have no coins in you game yet put this on the frame:

```auto

//
//Specify how many coins
var numCoins:Number = 67; //how many coins
/* 
or
use as to count coins
*/
var numCoins:Number = 0;
while(_root["coin"+numCoins]){
numCoins++;
}
//
//
for(var i:Number = 0; i<numCoins; i++){
_root["coin"+i].onEnterFrame = function(){
if(this.hitTest(char)){
score++;
trace(score);
this.unloadMovie();
}
}
}

```

if you already DO have coins in you game… on the first frame of the COIN MC, put this code(although, you can use this even if you dont have any coins on the stage at the moment)…

```auto

this._name = "coin"+_root.numCoins++;</

```

then on the frame of your movie

```auto

var numCoins:Number = 0;
setCoins = setInterval(function(){
for(var i:Number = 0; i<numCoins; i++){
_root["coin"+i].onEnterFrame = function(){
if(this.hitTest(char)){
score++;
trace(score);
this.unloadMovie();
}
}
}
clearInterval(setCoins);
}, 10);

```

let me know if this works… I just quickly typed it up in the little box lol, so I couldnt see half of what I wrote, and i cbf rechecking right now;)

---

<div class="post-metadata">

**Author:** ![Nich](https://avatars.discourse-cdn.com/v4/letter/n/e79b87/32.png) [@Nich](https://forum.kirupa.com/u/Nich)\
**Post date:** [April 18, 2006, 7:39pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/6 "2006-04-18T19:39:56Z")

</div>

```auto
while(_root["coin"+numCoins]){
numCoins++;
}

```

I’m not sure this would work…

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [April 18, 2006, 10:51pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/7 "2006-04-18T22:51:34Z")

</div>

lol… trust me I use that plenty:) And I know my stuff:lol: jk;)

---

<div class="post-metadata">

**Author:** ![Nich](https://avatars.discourse-cdn.com/v4/letter/n/e79b87/32.png) [@Nich](https://forum.kirupa.com/u/Nich)\
**Post date:** [April 19, 2006, 7:55pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/8 "2006-04-19T19:55:17Z")

</div>

Well, if you have time and wouldn’t mind explaining how, or pm me to now lead this thread off topic… It just seems to me it would be in infinate loop because you’re not actually comparing anything…

Oh, and I realise you know your stuff, I’ve been through your site and there is some pretty solide stuff on there.

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [April 19, 2006, 9:46pm UTC](https://forum.kirupa.com/t/need-help-with-game/185922/9 "2006-04-19T21:46:57Z")

</div>

lol. basically… if theres an object on the stage, it will return a value. like say if you wanted to see if something’s true, you only need: if(something) rather than running a strict comparison, this will check if something exists, != 0, != false etc… otherwise something will be returned as true. So basically if something exists it will return as \_level0.whatever, thus, being true. When there’s no more left, it will die:)

Hope thaT clears it up:thumb:
