Be a Supporter!

MC duping?

  • 311 Views
  • 4 Replies
New Topic Respond to this Topic
TheEvilOmen
TheEvilOmen
  • Member since: Aug. 6, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
MC duping? 2008-03-01 11:34:58 Reply

so one day i played this cool game calld VectorTD if im not mistaken. The complexity struck me and i immediately wanted to have a go. so i have been messing around for a few hours, but now i need to create a tile based system. So the player can only place the towers on separate squares.
I don't really know much about AS, but its a learning process. I thoght attachMovie was the way to go, because i need to have interactivity to a measure. But soon i encountered a problem while just prodding around. I got this bit from AS:Main and modified it.

:for(i=1;i<999;i++){
_root.duplicateMovie(_root.grid1,"grida"
+i, 1000+i);

_root["grida"+i]._x = i=1;i<999;i+9;
_root["grida"+i]._y = i=1;i<999;i+9;

}

When i hit Test Movie, it says a part of a script is making the player run slowly, and may cause a freeze.
I suppose there is a much better way of doing a grid sort of thing, so i'm hoping someone will point me in the right direction.
Help would be really helpful ....


OMENOMENOMENOMENOMENOMENOMENOMENOME NOMENOMENOMENOMENOMENOMENOMENOMENOM EN

West-End-Pro
West-End-Pro
  • Member since: Feb. 15, 2006
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to MC duping? 2008-03-01 11:43:22 Reply

The script is running slowly because you're making 998 MC's at once....

TheEvilOmen
TheEvilOmen
  • Member since: Aug. 6, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to MC duping? 2008-03-01 11:46:52 Reply

ok, i made 8 duplicates and it still crashed...


OMENOMENOMENOMENOMENOMENOMENOMENOME NOMENOMENOMENOMENOMENOMENOMENOMENOM EN

KaynSlamdyke
KaynSlamdyke
  • Member since: Jun. 25, 2004
  • Offline.
Forum Stats
Member
Level 16
Melancholy
Response to MC duping? 2008-03-01 12:21:11 Reply

At 3/1/08 11:34 AM, TheEvilOmen wrote: I got this bit from AS:Main and modified it.

for(i=1;i<999;i++){
_root.duplicateMovie(_root.grid1,"grida"
+i, 1000+i);

_root["grida"+i]._x = i=1;i<999;i+9;
_root["grida"+i]._y = i=1;i<999;i+9;

}

You modified it pretty badly. I mean infinate loop badly. It's setting i to 1 every iteration.
Let me explain. You've set up the for loop correctly, but these lines of code are doing retarded things.

: _root["grida"+i]._x = i=1;i<999;i+9;
: _root["grida"+i]._y = i=1;i<999;i+9;

What you've done here is
- set the new object's X coordinate to i... (_root["grida"+i]._x = i)
- which was FORCED to become 1 (i = 1)
- for some reason, just told Flash to say TRUE (i<999)
- and for some reason, done it again (i+9)

And then you did it again...

Why are you changing i?


...

BBS Signature
TheEvilOmen
TheEvilOmen
  • Member since: Aug. 6, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to MC duping? 2008-03-01 13:14:04 Reply

At 3/1/08 12:21 PM, KaynSlamdyke wrote:
Why are you changing i?

See, I wanted it to make 998 duplicates in a grid, where every 9 pixels it would draw the MC. So the for() loop was there, so it would make 998 copies, whereas the other two were supposed to make the MCs form an intervalled grid.
Of course its a really confusing way, which probably doesn't work, but thats exactly the problem.


OMENOMENOMENOMENOMENOMENOMENOMENOME NOMENOMENOMENOMENOMENOMENOMENOMENOM EN