-
Weird Problems- Have you had them?
I am making a game that uses arrays to keep track of soliders. For some reason, the arrays are very, very erratic. When I add new guys to the array, it makes is so old instances of the same type do not work. (I do use different instance names) But this only happens sometimes. Has anyone else had these problems, and could he/she tell me how to fix them.
Thanks/
Code:
onClipEvent(load){
trace("I am a geek")
}
-
Without seeing some code, difficult to say what is causing the problem.
Try looking at where you are setting the depths, your new instances need to have unique depths.
-
Code
Alright-heres the code
The instances are already onstage-so theres no need for levels
I am using a mac, if that matters. Similar code worked on a windows for me in MX 04.
The code below is Flash 8
Code:
Your=new Array()
Their-new Array()
Your.push({clip:"Yourcharacter",Type:25,Order:3,Health:35,Attack:7,Buildattack:1,Defense:4,Rangedefense:4})
Your.push({clip:"Yourwarrior1",Type:1,Order:1,Health:10,Attack:5,Buildattack:1,Defense:3,Rangedefense:3})
for(i=1;i<5;i++){
Their.push({clip:"Theirwarrior"+i,Type:1,Order:3,Health:10,Attack:5,Buildattack:1,Defense:3,Rangedefense:3})
}
Oh and, the variables still work, it's just the clip doesn't go into the array. As I said before Yourwarrior, Yourcharacter, and Theirwarrior 1-4 are already onstage.
Last edited by cornyanimation; 08-15-2006 at 02:16 PM.
Reason: Forgot something
Code:
onClipEvent(load){
trace("I am a geek")
}
-
This seems to work...
Code:
Your = new Array();
Their = new Array();
Your.push({clip:"Yourcharacter", Type:25, Order:3, Health:35, Attack:7, Buildattack:1, Defense:4, Rangedefense:4});
Your.push({clip:"Yourwarrior1", Type:1, Order:1, Health:10, Attack:5, Buildattack:1, Defense:3, Rangedefense:3});
for (var i = 1; i<5; i++) {
Their.push({clip:"Theirwarrior"+i, Type:1, Order:3, Health:10, Attack:5, Buildattack:1, Defense:3, Rangedefense:3});
}
trace(Their[1].clip);
-
Huh
I know, it doesn't work for me though. It's so screwed up.
Code:
onClipEvent(load){
trace("I am a geek")
}
-
Senior Member
Their = new Array();
not
Their - new Array();
- The right of the People to create Flash movies shall not be infringed. -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|