Thank very much and excuse me for my late answer.
Unfortunately it is not working, maybe because the way I constructed the intro.js file.
First part I made it like you said. The intro,js file is loaded in app.js and the layers are declared in the same way you said.
I think the problem is inside intro.js
In Intro class I have 3 functions.
Intro = function()
{
this.onAddToScene = function(){ //the first function
//where only one sprite is added to this.owner like this:
var logo = new Sprite('images/door/logo.png', wade.app.layers.doorButtons-1); // the front layer
this.owner.addSprite(logo, {x:0, y:0});
this.owner.setName('logo');
// the rest of the sprites(buttons, door, doorframe) looks like this:
this.commandsButton = new SceneObject(new Sprite('images/buttons/commandsButton.png', wade.app.layers.doorButtons));
this.commandsButton.setPosition(0, 0);
wade.addSceneObject(this.commandsButton);
// each button have here another function for button action
this.commandsButton.onMouseDown = function(){//the button action.....};
wade.addEventListener(this.commandsButton, 'onMouseDown');
// after this one the second button made in the same way - and all the elements of the door and at the end:
wade.addEventListener(this.owner, 'onMouseDown');
};
this.onMouseDown = function() // the second function- if you click on the logo, the logo and the 3 buttons move in the corners // of the door frame
{
var commands = this.commandsButton;
var score = this.scoreButton;
var play = this.playButton;
this.owner.moveTo(+325, +220, 1000);
commands.moveTo(+325, -220, 1000);
score.moveTo(-325, -220, 1000);
play.moveTo(-325, +220, 1000);
return true;
};
this.gateMovement = function() // used on click on the button(in function onMouseDown() attached to each buttonObject, is moving the door down and up again to see under the door different texts depending on the button you clicked
{
};
};
This is the Intro class function.
I loaded it in app.js in this.load = function(){};
In the same app.js after load function come this.init = function(){//here are just the setup things min/max screen size, multitouch a.s.o. and at the end this.door(); }
this.door = function(){
wade.addSceneObject(new SceneObject(0, Intro, 0, 0));
};
after this come this.game = function(){//the game} which is called from intro.js when you press PLAY button on the door frame.
I think is not a good thing to put in intro.js so many onMouseDown functions (one for each element of the door) in onAddToScene function but I didn't know how to do it in other way. It's hard cause I don't understand really good how js works, I just started to learn. For example you helped me a lot cause I learned now about parent and child and little by little I catch the sense.
I really don't know how to implement the bulletHole function.
I found this WADE and I liked it so muuuch that I decided to start learning.
Any kind of help is really appreciated. Thank you a lot.