From: christoph Date: Tue, 18 May 2010 22:11:16 +0000 (+0200) Subject: Enemies dont go away when hitting you anymore X-Git-Url: http://uxul.de/gitweb/?a=commitdiff_plain;h=a1b8d36904d4152a102637bdd61cbf064a247a72;p=uxul-world.git Enemies dont go away when hitting you anymore (I liked it that way, but dont so anymore). And you dont have to pass a :room-function to start-game anymore. --- diff --git a/README b/README index 7e933d9..8e524a7 100644 --- a/README +++ b/README @@ -1,12 +1,19 @@ -This Game is under development and may not be ready to use yet. +Last Updated 2010/05/19 -It depends on Lispbuilder-SDL (SVN-Revision 759 should work), LTK and lisp-magick. +This Game is under development and may not be ready to use yet. I will +try to keep this Readme current, but cant promise it. -To start the leveleditor, do (level-editor), it will return a sequence. Save this sequence -somewhere, say *a*. Then to play it, hit +It depends on Lispbuilder-SDL (SVN-Revision 759 should work), LTK and +lisp-magick. + +To start a testing-level, do (start-game). + +To start the leveleditor, do (level-editor), it will return a +sequence. Save this sequence somewhere, say *a*. Then to play it, hit (start-game :room-function #'(lambda () (create-room-from-item-list *a*))) -To edit *a* again, do (level-editor *a*), and your edited level will be returned. +To edit *a* again, do (level-editor *a*), and your edited level will +be returned. -I cant promis that all revisions I will make will work. +I cant promise that all revisions I will make will work. diff --git a/burning-marshmallow.lisp b/burning-marshmallow.lisp index 5d08382..cb8b374 100644 --- a/burning-marshmallow.lisp +++ b/burning-marshmallow.lisp @@ -101,12 +101,13 @@ (setf (animation obj) (slot-value obj 'rd-animation))))))) +; already defined in simple-enemy.lisp - possibly a bug? -(defun simple-enemy-and-player (player enemy) - (decf (power player)) - (setf (active enemy) nil) - (setf (visible enemy) nil) - (setf (colliding enemy) nil)) +;; (defun simple-enemy-and-player (player enemy) +;; (decf (power player)) +;; (setf (active enemy) nil) +;; (setf (visible enemy) nil) +;; (setf (colliding enemy) nil)) (defmethod player-hits-enemy ((player player) (enemy burning-marshmallow) &rest args) (declare (ignore args)) diff --git a/game.lisp b/game.lisp index 8051f9f..fd366fd 100755 --- a/game.lisp +++ b/game.lisp @@ -11,7 +11,9 @@ (start-game :room-function #'(lambda () (create-room-from-item-list item-list)))) -(defun start-game (&key (music nil) room-function (15-fps nil)) +(defun start-game (&key (music nil) + (room-function #'make-testing-room) + (15-fps nil)) "Start the Game: Call room-function for getting the room-object to run. Music is ignored so far. 15-fps makes only every second frame be drawn (for very slow computers)" diff --git a/on-collision.lisp b/on-collision.lisp index 68e284e..8647884 100755 --- a/on-collision.lisp +++ b/on-collision.lisp @@ -77,7 +77,11 @@ (setf (autojump moving-rectangle) 5) (player-hits-enemy moving-rectangle standing-rectangle - collision)) + collision) + (setf (colliding standing-rectangle) nil) + (move-about moving-rectangle (desired-movement collision)) + (setf (colliding standing-rectangle) t) +) (defmethod on-collision ((moving-rectangle player) @@ -225,4 +229,8 @@ collision) (enemy-hits-player moving-rectangle standing-rectangle - collision)) + collision) + (setf (colliding standing-rectangle) nil) + (move-about moving-rectangle (desired-movement collision)) + (setf (colliding standing-rectangle) t) +) diff --git a/simple-enemy.lisp b/simple-enemy.lisp index ae8d3b7..c1614c9 100755 --- a/simple-enemy.lisp +++ b/simple-enemy.lisp @@ -34,17 +34,15 @@ (setf (activated obj) T)))))) (defun simple-enemy-and-player (player enemy) - (decf (power player)) - (setf (active enemy) nil) - (setf (visible enemy) nil) - (setf (colliding enemy) nil)) + (decf (power player))) (defmethod player-hits-enemy ((player player) (enemy simple-enemy) &rest args) (cond ((eql (direction (car args)) :DOWN) (setf (animation enemy) (flat-animation enemy)) (setf (active enemy) nil) - (setf (colliding enemy) nil)) + (setf (colliding enemy) nil) + (setf (listen-to player) (remove enemy (listen-to player)))) (T (simple-enemy-and-player player enemy))))