projects
/
uxul-world.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Works again.
[uxul-world.git]
/
player.lisp
diff --git
a/player.lisp
b/player.lisp
index
a111e43
..
b363767
100755
(executable)
--- a/
player.lisp
+++ b/
player.lisp
@@
-1,4
+1,4
@@
-;;; Copyright 2009 Christoph Senjak
+;;; Copyright 2009
-2011
Christoph Senjak
(in-package :uxul-world)
(in-package :uxul-world)
@@
-28,6
+28,12
@@
:initform (make-animation 7
|uxul_small1|
|uxul_small2|))
:initform (make-animation 7
|uxul_small1|
|uxul_small2|))
+ (last-y :initarg :last-pos
+ :accessor last-y
+ :initform nil)
+ (bounced :initarg :bounced
+ :accessor bounced
+ :initform nil)
(jump-accel :accessor jump-accel
:initform -50)
(mayjump :accessor mayjump
(jump-accel :accessor jump-accel
:initform -50)
(mayjump :accessor mayjump
@@
-69,10
+75,12
@@
:documentation "after hit by an enemy you wont be
wounded by another enemy for that ammount of
frames.")
:documentation "after hit by an enemy you wont be
wounded by another enemy for that ammount of
frames.")
- (keys :initform 0
+ (keys :initform nil
+ :initarg :keys
:accessor keys
:accessor keys
- :documentation "Number of keys for doors")
- ))
+ :documentation "List of Key-Dungeons of keys (i.e. for every
+ key its key-dungeon is pushed on that list, for every door, its
+ removed again).") ))
;; Interaction with enemies
;; Interaction with enemies
@@
-112,6
+120,12
@@
(class-name (class-of item))
(class-name (class-of player))))
(class-name (class-of item))
(class-name (class-of player))))
+(defmethod item-catch ((item key) (player player) &rest args)
+ (declare (ignore args))
+ (push (dungeon item) (keys player))
+ (setf (visible item) nil)
+ (setf (colliding item) nil))
+
(defmethod (setf animation) ((new-value animation) (object player))
(setf (x new-value) (+ (x object) (x(animation-translation object))))
(setf (y new-value) (+ (y object) (y(animation-translation object))))
(defmethod (setf animation) ((new-value animation) (object player))
(setf (x new-value) (+ (x object) (x(animation-translation object))))
(setf (y new-value) (+ (y object) (y(animation-translation object))))
@@
-153,6
+167,16
@@
(defmethod invoke ((obj player))
"Do whatever a player does ^^"
(defmethod invoke ((obj player))
"Do whatever a player does ^^"
+ (cond
+ ((bounced obj)
+ (setf (bounced obj) nil))
+ ((and
+ (last-y obj)
+ (< (last-y obj) (y obj)))
+ (setf (mayjump obj) nil)))
+
+ (setf (last-y obj) (y obj))
+
;; SIMPLE GRAVITY HACK
(setf (key-pressed-down obj) (not (key-pressed-up obj)))
;; SIMPLE GRAVITY HACK
(setf (key-pressed-down obj) (not (key-pressed-up obj)))