[JS] Click mouse html5
Inviato: martedì 15 aprile 2014, 11:45
salve, ho questo mini gioco che sto facendo , ma non riesco ad capire come far che l'utente se clicca sopra lo sprite gli viene aggiunto il punteggio +10..
ecco il pezzo che sto facendo :
come si può usare l'evento click del mouse ?
grazie mille.
ecco il pezzo che sto facendo :
Codice: Seleziona tutto
var game_width = 800;
var game_height = 550;
var logo_html5_x = 100;
var logo_html5_y = 100;
var logo_html5 = loadSprite('media/test/html5.png');
function initGame()
{
setGameBackground('#ffbf18');
game.addEventListener('click', game_mouseDown, false);
}
function game_mouseDown (e) {
}
function draw()
{
GameClear();
drawImage(logo_html5,logo_html5_x, logo_html5_y);
}
function update()
{
logo_html5_x = Math.random() * game_width;
logo_html5_y = Math.random() * game_height;
}grazie mille.