Guest User

Untitled

a guest
Dec 11th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. // Gère les clicks en fonction de l'état du jeu
  2. function checkClick(event) {
  3. if (gameModel.stateGame != constState.STATE_RUNNING) {
  4. var btnStart = ui.resources.images['btn_start'];
  5. var finalHeight = btnStart.height * ui.ratio,
  6. finalWidth = btnStart.width * ui.ratio;
  7. var x = (ui.canvas.width / 2) - ((btnStart.width * ui.ratio) / 2), y = ui.canvas.height - finalHeight - (isPortrait() ? 100 : 50);
  8. var xClick = event.pageX,
  9. yClick = event.pageY;
  10. if (yClick > y && yClick < (y + finalHeight) && xClick > x && xClick < (x + finalWidth)) {
  11. // On change l'état du jeu
  12. gameModel.stateGame = gameModel.stateGame === constState.STATE_ACCUEIL ? constState.STATE_RUNNING : constState.STATE_ACCUEIL;
  13. ...
  14. }
  15. }
  16. }
Add Comment
Please, Sign In to add comment