-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheffect.lisp
50 lines (35 loc) · 1.07 KB
/
effect.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;;;; effect.lisp
(in-package :com.eliasfeijo.pong)
(defclass effect ()
((time-started :initform (real-time-seconds) :reader time-started)
(duration :reader duration-of)
(target :initarg :target)))
(defgeneric start-effect (effect))
(defgeneric stop-effect (effect))
;;; Burning
(defclass burning (effect)
((duration :initform 2.0)))
(defmethod start-effect ((this burning))
(with-slots (target) this
(setf (speed-of target) 2000)))
(defmethod stop-effect ((this burning))
(with-slots (target) this
(setf (speed-of target) 500)))
;;; Slow
(defclass slow (effect)
((duration :initform 1.0)))
(defmethod start-effect ((this slow))
(with-slots (target) this
(setf (speed-of target) 100)))
(defmethod stop-effect ((this slow))
(with-slots (target) this
(setf (speed-of target) 500)))
;;; Slow
(defclass slip (effect)
((duration :initform 1.0)))
(defmethod start-effect ((this slip))
(with-slots (target) this
(setf (speed-of target) 1000)))
(defmethod stop-effect ((this slip))
(with-slots (target) this
(setf (speed-of target) 300)))