Hey guys i'm trying to create a point n click game using AS3 and external files and i'm having a hard time to get the invetory working.
So let me explain that better...
The game I want to create is an escape game ( You're locked in a room and need to find itens and hints to get out of there)
On my .fla file (Teste.fla) there's a hammer handle and a hammer head. Both are movieclips (head name = cabeca and handle name = cabo).
Here are my codes so far.
Cabo.as:
Code:
package{
public class Cabo extends Teste
{
}
}
Cabeca.as:
Code:
package{
public class Cabeca extends Teste
{
}
}
Teste.as:
Code:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Teste extends MovieClip
{
public function Teste():void
{
buttonMode = true;
addEventListener(MouseEvent.CLICK, pegaritem);
}
protected function pegaritem (e:MouseEvent):void
{
parent.addChild(this);
trace("pegou "+name);
x = 50;
y = 330;
width=50;
scaleX=scaleY;
if(height>50)
{
height=50;
scaleX=scaleY;
}
removeEventListener(MouseEvent.CLICK, pegaritem);
}
}
}
So the problem is: When I click on a movieclip (cabeca or cabo), they move to the same position.
What I want to do is to get the side by side separated by a few pixels.
I've been looking for a solution and i found out that i should arrange them on an Array... But unfortunately I have no idea how to do that.
I'm pretty new to using AS3 and external files.
Anyone has an idea how i can do that?