Original Post
Hello guys.
I have been working in this single thing for more than 3 hours and can't get it done.
I want to add a listener to the main character in the game.
I'm using MainCharacter.as file to have al the properties and movements of it.
So far, everything works (appears in the scene, I can even click on it and trace works)
But when I want it to move when I press a button, it doesn't work.
I have an instance of the Main.as file that I'm using to addChild all the things of the game (including the main char, and works great)
Ok well,I tried:
addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
scene.addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
Main._instanceMain.addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
and so much more I can't remember. But it doesn't work.
I even try to do it inside PlayGame.as and didn't work either.
What could it be??!
Thanks guys, ANY ANY suggestions will be much appreciated !!
I have been working in this single thing for more than 3 hours and can't get it done.
I want to add a listener to the main character in the game.
I'm using MainCharacter.as file to have al the properties and movements of it.
So far, everything works (appears in the scene, I can even click on it and trace works)
But when I want it to move when I press a button, it doesn't work.
I have an instance of the Main.as file that I'm using to addChild all the things of the game (including the main char, and works great)
Ok well,I tried:
addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
scene.addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
Main._instanceMain.addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
and so much more I can't remember. But it doesn't work.
I even try to do it inside PlayGame.as and didn't work either.
What could it be??!
Thanks guys, ANY ANY suggestions will be much appreciated !!