emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/play/pong.el


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/lisp/play/pong.el
Date: Tue, 04 Feb 2003 08:20:43 -0500

Index: emacs/lisp/play/pong.el
diff -c emacs/lisp/play/pong.el:1.11 emacs/lisp/play/pong.el:1.12
*** emacs/lisp/play/pong.el:1.11        Fri Sep 13 09:30:09 2002
--- emacs/lisp/play/pong.el     Tue Feb  4 08:20:41 2003
***************
*** 34,45 ****
  
  ;;; Customization
  
! (defgroup pong nil 
    "Emacs-Lisp implementation of the classical game pong."
    :tag "Pong"
    :group 'games)
  
! (defcustom pong-buffer-name "*Pong*" 
    "*Name of the buffer used to play."
    :group 'pong
    :type '(string))
--- 34,45 ----
  
  ;;; Customization
  
! (defgroup pong nil
    "Emacs-Lisp implementation of the classical game pong."
    :tag "Pong"
    :group 'games)
  
! (defcustom pong-buffer-name "*Pong*"
    "*Name of the buffer used to play."
    :group 'pong
    :type '(string))
***************
*** 313,324 ****
        (gamegrid-set-cell x (1- y) pong-blank))
      (if (< (+ y pong-bat-width) (1- pong-height))
        (gamegrid-set-cell x (+ y pong-bat-width) pong-blank)))))
!   
  
  
  (defun pong-init ()
    "Initialize a game."
!   
    (define-key pong-mode-map pong-pause-key 'pong-pause)
  
    (add-hook 'kill-buffer-hook 'pong-quit nil t)
--- 313,324 ----
        (gamegrid-set-cell x (1- y) pong-blank))
      (if (< (+ y pong-bat-width) (1- pong-height))
        (gamegrid-set-cell x (+ y pong-bat-width) pong-blank)))))
! 
  
  
  (defun pong-init ()
    "Initialize a game."
! 
    (define-key pong-mode-map pong-pause-key 'pong-pause)
  
    (add-hook 'kill-buffer-hook 'pong-quit nil t)
***************
*** 345,388 ****
  detection and checks if a player scores."
    (if (not (eq (current-buffer) pong-buffer))
        (pong-pause)
!       
      (let ((old-x pong-x)
          (old-y pong-y))
!       
        (setq pong-x (+ pong-x pong-xx))
        (setq pong-y (+ pong-y pong-yy))
!       
        (if (and (> old-y 0)
               (< old-y (- pong-height 1)))
          (gamegrid-set-cell old-x old-y pong-blank))
!       
        (if (and (> pong-y 0)
               (< pong-y (- pong-height 1)))
          (gamegrid-set-cell pong-x pong-y pong-ball))
!       
        (cond
         ((or (= pong-x 3) (= pong-x 2))
!       (if (and (>= pong-y pong-bat-player1) 
                 (< pong-y (+ pong-bat-player1 pong-bat-width)))
!           (and 
             (setq pong-yy (+ pong-yy
!                             (cond 
                               ((= pong-y pong-bat-player1) -1)
                               ((= pong-y (1+ pong-bat-player1)) 0)
                               (t 1))))
             (setq pong-xx (- pong-xx)))))
  
         ((or (= pong-x (- pong-width 4)) (= pong-x (- pong-width 3)))
!       (if (and (>= pong-y pong-bat-player2) 
                 (< pong-y (+ pong-bat-player2 pong-bat-width)))
!           (and 
             (setq pong-yy (+ pong-yy
!                             (cond 
                               ((= pong-y pong-bat-player2) -1)
                               ((= pong-y (1+ pong-bat-player2)) 0)
                               (t 1))))
             (setq pong-xx (- pong-xx)))))
!    
         ((<= pong-y 1)
        (setq pong-yy (- pong-yy)))
  
--- 345,388 ----
  detection and checks if a player scores."
    (if (not (eq (current-buffer) pong-buffer))
        (pong-pause)
! 
      (let ((old-x pong-x)
          (old-y pong-y))
! 
        (setq pong-x (+ pong-x pong-xx))
        (setq pong-y (+ pong-y pong-yy))
! 
        (if (and (> old-y 0)
               (< old-y (- pong-height 1)))
          (gamegrid-set-cell old-x old-y pong-blank))
! 
        (if (and (> pong-y 0)
               (< pong-y (- pong-height 1)))
          (gamegrid-set-cell pong-x pong-y pong-ball))
! 
        (cond
         ((or (= pong-x 3) (= pong-x 2))
!       (if (and (>= pong-y pong-bat-player1)
                 (< pong-y (+ pong-bat-player1 pong-bat-width)))
!           (and
             (setq pong-yy (+ pong-yy
!                             (cond
                               ((= pong-y pong-bat-player1) -1)
                               ((= pong-y (1+ pong-bat-player1)) 0)
                               (t 1))))
             (setq pong-xx (- pong-xx)))))
  
         ((or (= pong-x (- pong-width 4)) (= pong-x (- pong-width 3)))
!       (if (and (>= pong-y pong-bat-player2)
                 (< pong-y (+ pong-bat-player2 pong-bat-width)))
!           (and
             (setq pong-yy (+ pong-yy
!                             (cond
                               ((= pong-y pong-bat-player2) -1)
                               ((= pong-y (1+ pong-bat-player2)) 0)
                               (t 1))))
             (setq pong-xx (- pong-xx)))))
! 
         ((<= pong-y 1)
        (setq pong-yy (- pong-yy)))
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]