Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Gère les clicks en fonction de l'état du jeu
- function checkClick(event) {
- if (gameModel.stateGame != constState.STATE_RUNNING) {
- var btnStart = ui.resources.images['btn_start'];
- var finalHeight = btnStart.height * ui.ratio,
- finalWidth = btnStart.width * ui.ratio;
- var x = (ui.canvas.width / 2) - ((btnStart.width * ui.ratio) / 2), y = ui.canvas.height - finalHeight - (isPortrait() ? 100 : 50);
- var xClick = event.pageX,
- yClick = event.pageY;
- if (yClick > y && yClick < (y + finalHeight) && xClick > x && xClick < (x + finalWidth)) {
- // On change l'état du jeu
- gameModel.stateGame = gameModel.stateGame === constState.STATE_ACCUEIL ? constState.STATE_RUNNING : constState.STATE_ACCUEIL;
- ...
- }
- }
- }
Add Comment
Please, Sign In to add comment