Variable prob. (Example fla inside)
- Johnnsen
-
Johnnsen
- Member since: Jan. 14, 2007
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
Alright I figured out why my stuff doesn't work.
I have a plane movieclip which chooses a plane sprite randomly. When you drop a bomb the bomb should choose the sprite fitting the plane that it was dropped by. (Plane 1 drops bomb 1, plane 2 drops bomb 2)
This works if I have one plane already on the stage, and no others. However, if I attach more plane movieclips it drops only bombs with the same sprite. (plane 1 and plane 2 only drop bomb 1)
Here is an example fla/swf:
http://dl.dropbox.com/u/6414392/plane%20 example.zip
I commented the code a little, its not much. If you delete the controller movie clip and put the plane on the stage then it will work. Use it like it is and it doesn't.
This is driving me nuts, but I am probably only missing one little thing that makes it not work when attaching movieclips.
Blood For The Bloodgod
- Johnnsen
-
Johnnsen
- Member since: Jan. 14, 2007
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
Dropbox seems to have messed up (or me) but the download link doesn't work. Here is the correct one:
http://dl.dropbox.com/u/6414392/plane%20 example.zip
Also: By "attach more planes" I meant attaching by code, as in attachMovieClip
Blood For The Bloodgod
- AntiAliasProductionz
-
AntiAliasProductionz
- Member since: Apr. 20, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 10/13/10 04:03 PM, Johnnsen wrote: Dropbox seems to have messed up (or me) but the download link doesn't work. Here is the correct one:
http://dl.dropbox.com/u/6414392/plane%20 example.zip
Also: By "attach more planes" I meant attaching by code, as in attachMovieClip
From what i can tell, you're not using the same variable for the plane and bomb type.
Make a public variable in the main class like
public var type = Math.floor(math.random()*2+1)
Or you need to add one to the end of it
public var bomb_type = Math.floor(math.random()*2+1+1)
Try either.

