You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.2 KiB

4 years ago
  1. app.controller('HomeController', function($scope, $document, $interval) {
  2. $scope.camara = angular.element('#carousel');
  3. $scope.play = true;
  4. $scope.pika = -190;
  5. $scope.t = {
  6. x: 30,
  7. y: 16,
  8. z: 455
  9. }
  10. $scope.r = {
  11. x: 0,
  12. y: 0,
  13. z: 0
  14. }
  15. var move = function(e){
  16. if (e.keyCode == 38) {
  17. $scope.t.z = $scope.t.z + 2;
  18. }
  19. if (e.keyCode == 40) {
  20. $scope.t.z = $scope.t.z - 2;
  21. }
  22. if (e.keyCode == 37) {
  23. $scope.t.x = $scope.t.x + 2;
  24. }
  25. if (e.keyCode == 39) {
  26. $scope.t.x = $scope.t.x - 2;
  27. }
  28. if (e.keyCode == 65) {
  29. $scope.t.y = $scope.t.y + 2;
  30. }
  31. if (e.keyCode == 90) {
  32. $scope.t.y = $scope.t.y - 2;
  33. }
  34. if (e.keyCode == 81) {
  35. $scope.r.y = $scope.r.y + 2;
  36. }
  37. if (e.keyCode == 87) {
  38. $scope.r.y = $scope.r.y - 2;
  39. }
  40. };
  41. $document.on('keydown', move);
  42. $scope.playStop = function(){
  43. if($scope.play == false){
  44. $scope.play = true;
  45. }else{
  46. $scope.play = false;
  47. }
  48. }
  49. $interval( function(){
  50. if($scope.play == true){
  51. if($scope.t.z<1000){
  52. $scope.t.z = $scope.t.z+1;
  53. }else{
  54. $scope.t.z = 455;
  55. }
  56. if($scope.pika < 300){
  57. $scope.pika = $scope.pika + 10;
  58. }else{
  59. $scope.pika = -190
  60. }
  61. }
  62. }, 50);
  63. });
  64. /*
  65. var konami_keys = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65], konami_index = 0;
  66. var handler = function(e) {
  67. if (e.keyCode === konami_keys[konami_index++]) {
  68. if (konami_index === konami_keys.length) {
  69. // $document.off('keydown', handler);
  70. modal = modalCreate($modal,"konami", "We are very sorry.", "We are really sorry but we are still developing the system to increase the number of lifes.");
  71. scope.$apply(scope.konami);
  72. }
  73. } else {
  74. konami_index = 0;
  75. }
  76. };
  77. */