PDA

View Full Version : Symbol to load new layer?


ZockAvenger
10-07-2010, 05:39 PM
Right so I'm a noob when it comes to AS, I've done some simple flash animations before using tweens etc. I've done a lot of HTML work, some PHP and some Java.

I'm in the middle of a small personal project developing a Platform game in Flash CS4...

here is the game so far - rollock. stormloader . com (without spaces - I'm a tad low on posts!)

if you go to the end of the level, (past the spikes) there is two platforms, on the second I'm hoping to put a star or circle to change the ground layer and reset the character.

all of the brown squares with green stroke and the ladders are on one layer. Then the character on another and so on.

Now my problem lies in I'm not quite sure what AS to apply to the circle/star to change the ground layer to a new 'track' to play on.

If any body can help me, or give me a step by step tutorial that would brilliant!

Thanks in advance,
Zack

Rada
10-12-2010, 07:08 PM
First, your game is awesome and runs pretty well.

I can't write a step by step tutorial, but what you should do, is build your levels as MovieClip's in your library. Export them for Actionscript by giving each one a class name. So if you have 2 levels one might be Level1 and the other might be Level2.

in your code you would say

var lvl1:Level1 = new Level1();
var lvl2:Level2 = new Level2();

addChild(lvl1);


so when you want to change to level 2 you would remove level 1, and add level 2 in its place


removeChild(lvl1);
addChild(lvl2);



When building games it is important to know some basics about object oriented programming. Did you do any OOP programming in Java or PHP?