1 decade ago by Fooshi
Hello,
I want to create a game like a "scratch card". I have two image and when the cursor of the mouse is pressed i want the area of the mouse discover the background image.
Then i have create an instance entity for the firt image and a game instance like this :
Then i don't know how to load the entity on the game and to change the alpha of this entity.
I want to create a game like a "scratch card". I have two image and when the cursor of the mouse is pressed i want the area of the mouse discover the background image.
Then i have create an instance entity for the firt image and a game instance like this :
ig.module(
'game.main'
)
.requires(
'impact.entity',
'impact.game',
'impact.font',
'impact.image',
'impact.map',
'impact.input',
'impact.animation'
)
.defines(function(){
FirstEntity = ig.Entity.extend({
size : {x:320, y:480},
animSheet : new ig.AnimationSheet('media/fond.jpg',320,480),
init : function(x,y,settings){
this.addAnim('idle',0.1,[0]);
this.parent(x,y,settings);
}
});
// Classe du Jeu
TotemGame = ig.Game.extend({
clearColor : '#FFF',
euro1 : new ig.Image('media/euro1.png'),
background : new ig.Image('media/fond.jpg'),
init : function(){
ig.input.bind(ig.KEY.MOUSE1, 'scratch'); // Ecouteur de la souris
this.euro1.draw(0,0);
},
update : function(){
if(ig.input.state('scratch'))
{
console.log('X :'+ig.input.mouse.x+' Y :'+ig.input.mouse.y);
}
},
draw : function(){
}
});
ig.main('#canvas', TotemGame, 60, 320, 480, 1);
});
Then i don't know how to load the entity on the game and to change the alpha of this entity.
