PDA

View Full Version : Duplicate coins



gaming monkey
November 14th, 2004, 01:06 PM
Ok, i'm thinking of starting to do a little platformer based on this:

http://www.gotoandplay.it/_articles/2004/04/platform.php

Now in that example the apples are seperate movieclips, but if i were to have many more on stage it wold really slow flash down, so i will need to attach movie or duplicate movie.
Now I'm unsure of this, so does anyone have any helpful sites or anything that would help me. I'd like for the coins to be placed in certain areas so the code will need to put a coin in a certain position.
Could anyone please possibly help me out in anyway, it would be great if someone could explain a little code to me.

Thank you.

Dr Warm
November 14th, 2004, 09:56 PM
in the main timeline have:

//these are the _x and then _y pos of your apples
applePos = [[245, 200], [200, 240], [350, 240], [190, 320], [275, 320], [360, 320]];
_root.createEmptyMovieClip("empty", 10);
for (var i = 0; i<applePos.length; i++) {
//give the apple movieclip a linkage name apple (in the library)
_root["empty"].attachMovie("apple", "apple"+i, 1000+i);
var apple = _root.empty["apple"+i];
apple._x = applePos[i][0];
apple._y = applePos[i][1];
}
with scrolling this will get a bit screwy, as you'll have to move all of them with the map. hope you understand this!

gaming monkey
December 22nd, 2004, 05:51 PM
I know this thread is old, but I completely forgot about it. I'm now starting to work on this again. The code provided worked great (thank you). My question is about collision with the player.

I've been trying to find the most efficient code for when the player hits the apple it gets removed. Could anyone help me with this part because I can't think of any code to make it work.
Thank you.