# Help with instances?

**URL:** <https://forum.kirupa.com/t/help-with-instances/8764>\
**Category:** Uncategorized\
**Created:** [November 27, 2002, 11:31pm UTC](https://forum.kirupa.com/t/help-with-instances/8764 "2002-11-27T23:31:26Z")\
**Posts on this page:** 20\
**Page:** 2

<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:** [November 29, 2002, 10:42am UTC](https://forum.kirupa.com/t/help-with-instances/8764/21 "2002-11-29T10:42:05Z")

</div>

I put meteor(s) out of the \_root inside another movieclip but now I have to redefine some things like this:  
ext = \_root[‘m’+ii]  
ext.\_x = Math.random()\*640  
How should I define the “ext” when the movieclip isn’t in the root anymore?

---

<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:** [November 29, 2002, 12:56pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/22 "2002-11-29T12:56:53Z")

</div>

David’s idea is excellent. If you put all your asteroids in the same movie clip, everything will be much simpler. You could also consider creating an object containing all the properties of an asteroid for each asteroid. [size=1]Well, that’s what Jobe Makar does in his book…[/size] 🙂

And David, I was just trying to say that when you use for in loops, it’s better to write the path completely

```auto
for (mc in _root) {
    if (this.hitTest( **_root.** mc)) {

```

🙂

---

<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:** [November 29, 2002, 2:32pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/23 "2002-11-29T14:32:06Z")

</div>

ohh… yeah, that’s a good idea. See told you I was Flash ‘cold’.

---

<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:** [November 29, 2002, 4:14pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/24 "2002-11-29T16:14:54Z")

</div>

ok here’s what I got so far. It’s incomplete as the shot doesn’t fire from the ship yet, and it doesn’t take damage the way I want it to… namely like the old asteroids game where you get hit, the ship fades for a few seconds (at which time it’s invulnerable) and then it comes back to visible with damage.

Take a look at it. scalp what you need.

If anyone has any fixes for it, please feel free.

only 27k so far… and the swf is only 4 k so far… pretty nice

---

<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:** [November 29, 2002, 6:04pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/25 "2002-11-29T18:04:02Z")

</div>

I checked the game out but no collision detection… :-  
I still have to know how to use this:  
ext = \_root[‘m’+ii]  
when the “m”+ii is not in \_root. Instead it’s inside another movieclip.

---

<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:** [November 29, 2002, 6:35pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/26 "2002-11-29T18:35:19Z")

</div>

ext = \_root.containerClip[‘m’+ii];

or whatever else you want in the string.

---

<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:** [November 29, 2002, 7:12pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/27 "2002-11-29T19:12:18Z")

</div>

Thanks to all of you! =) =)  
I got the collision detection working and I’ve got basically everything working in the game that I wanted.  
Thanks again. 🙂

---

<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:** [November 29, 2002, 7:27pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/28 "2002-11-29T19:27:23Z")

</div>

you’ve got to post an end result for us. I love games. 🙂

---

<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:** [November 29, 2002, 7:43pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/29 "2002-11-29T19:43:34Z")

</div>

Can’t add swf files as an attachment? :o

---

<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:** [November 29, 2002, 8:48pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/30 "2002-11-29T20:48:09Z")

</div>

Ok, here it is even though it’s not complete. It still needs a few things like the  
“try again” button I had to disable because of some problems. :-  
But I guess I’ll try to work them out on my own.  
Thanks to everyone for helping me out with this little experiment. 🙂

---

<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:** [December 1, 2002, 2:51pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/31 "2002-12-01T14:51:14Z")

</div>

I can’t look at your file right now, but i just remembered that there is a tutorial at MM’s explaining how to build your own Ateroids game, from A to Z. Might be interesting to compare with your fla when you’re done 🙂

---

<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:** [December 1, 2002, 11:01pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/32 "2002-12-01T23:01:42Z")

</div>

I’ve been making the game more now and right now I’m dealing with some collision detection inaccuracy issues…  
But actually the game I’m making isn’t a traditional “asteroids” game. You have to evade asteroids as long as you can and as you survive longer, the game gets harder and you get more score. 😛

---

<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:** [December 3, 2002, 1:32am UTC](https://forum.kirupa.com/t/help-with-instances/8764/33 "2002-12-03T01:32:18Z")

</div>

Well I got a bit of a problem here.  
I’d like to make a LOCAL highscore list for the asteroid game.  
It should save the scores to a text file on the harddrive and read them when needed.  
I have no clue on how to do this… If anyone does, please tell me. 🙂

---

<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:** [December 3, 2002, 3:08am UTC](https://forum.kirupa.com/t/help-with-instances/8764/34 "2002-12-03T03:08:32Z")

</div>

If you’re using Flash MX, you could use the shared objects. That’s what they’re made for 🙂  
Otherwise, PHP is the way to go, baby!!

---

<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:** [December 3, 2002, 11:06am UTC](https://forum.kirupa.com/t/help-with-instances/8764/35 "2002-12-03T11:06:49Z")

</div>

Yes, I’m using FlashMX. 🙂  
Shared objects? What are they:q: =)  
Oh… and if I use PHP, how to do it locally?

---

<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:** [December 3, 2002, 2:41pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/36 "2002-12-03T14:41:46Z")

</div>

There is a tute about shared objects. And concerning the PHP thing, you should post it in the server-side section.

pom :cowboy:

---

<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:** [December 3, 2002, 5:07pm UTC](https://forum.kirupa.com/t/help-with-instances/8764/37 "2002-12-03T17:07:19Z")

</div>

I really enjoyed this thread, and voted a 4 for it! 😛

=)

---

<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:** [December 4, 2002, 11:53am UTC](https://forum.kirupa.com/t/help-with-instances/8764/38 "2002-12-04T11:53:11Z")

</div>

Thanks for voting. 🙂  
Thanks for the help everyone!  
It works perfect now! =)

---

<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:** [December 5, 2002, 2:38am UTC](https://forum.kirupa.com/t/help-with-instances/8764/39 "2002-12-05T02:38:26Z")

</div>

Well, in that case it would need a little clean-up, don’t you think?

pom 🙂

---

<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:** [December 5, 2002, 2:42am UTC](https://forum.kirupa.com/t/help-with-instances/8764/40 "2002-12-05T02:42:25Z")

</div>

Why php, shared objects are really cool. 🙂

[Previous page](https://forum.kirupa.com/t/help-with-instances/8764.md?page=1)

[Next page](https://forum.kirupa.com/t/help-with-instances/8764.md?page=3)
