Browse files

better explosions

  • Loading branch information...
1 parent d35fd02 commit a1ac7495702e1fba93e5b49ac69d05762c4e47ee David O'Toole committed Mar 29, 2010
Showing with 123 additions and 13 deletions.
  1. +0 −1 cons/archive.lisp
  2. +1 −0 cons/cons.org
  3. +2 −1 cons/cons.pak
  4. +0 −3 cons/corridor.lisp
  5. +10 −5 cons/enemies.lisp
  6. +4 −0 cons/player.lisp
  7. +90 −0 cons/security.lisp
  8. +16 −3 cons/things.lisp
View
1 cons/archive.lisp
@@ -19,7 +19,6 @@
[play-sample self "bip"]
[damage self 1])
-
;;; Archive world generation
(define-prototype archive (:parent =sector=)
View
1 cons/cons.org
@@ -7,6 +7,7 @@
**** TODO destroyable drones
**** TODO defended cores
*** TODO TODO security sector play breakout using snake as paddle, pong ball is an item
+*** TODO security crate
*** TODO corridor sector
*** TODO archive sector
*** TODO xiotank sector!
View
3 cons/cons.pak
@@ -821,7 +821,7 @@
(:name "break" :type :sample :file "break.wav" :properties (:volume 20))
(:name "fire" :type :sample :file "fire.wav" :properties (:volume 10))
- (:name "break2" :type :sample :file "break2.wav" :properties (:volume 13))
+ (:name "break2" :type :sample :file "break2.wav" :properties (:volume 7))
(:name ".default-font" :type :font :properties (:height 14 :width 7) :data "7x14b")
(:name "cons-package-lisp" :type :lisp :file "cons-package.lisp" :properties (:autoload t))
@@ -834,6 +834,7 @@
(:name "reactor-lisp" :type :lisp :file "reactor.lisp" :properties (:autoload t))
(:name "archive-lisp" :type :lisp :file "archive.lisp" :properties (:autoload t))
(:name "storage-lisp" :type :lisp :file "storage.lisp" :properties (:autoload t))
+ (:name "security-lisp" :type :lisp :file "security.lisp" :properties (:autoload t))
(:name "player-lisp" :type :lisp :file "player.lisp" :properties (:autoload t))
(:name "enemies-lisp" :type :lisp :file "enemies.lisp" :properties (:autoload t))
(:name ".startup" :type :lisp :file "cons.lisp" :properties (:autoload t))
View
3 cons/corridor.lisp
@@ -374,9 +374,6 @@
(accent :initform "corridor-accent")
(grammar :initform
'((world >> (10 :jump 90 :right 10 :jump =exit= :color :drop))))
-
-
-
;;
(ambient-light :initform :total)
(required-modes :initform nil)
View
15 cons/enemies.lisp
@@ -343,33 +343,38 @@ They fire powerful heat-seeking bullets, but these can be shot down."))
(defcell rook
(categories :initform '(:actor :target :obstacle :opaque :enemy))
+ (auto-loadout :initform t)
(equipment-slots :initform '(:robotic-arm :shoulder-mount))
(attacking-with :initform :robotic-arm)
(firing-with :initform :robotic-arm)
(dexterity :initform (make-stat :base 20))
(max-items :initform (make-stat :base 1))
- (speed :initform (make-stat :base 12))
- (chase-distance :initform 10)
+ (speed :initform (make-stat :base 2))
+ (chase-distance :initform 15)
(stepping :initform t)
(behavior :initform :seeking)
(clock :initform 0)
(last-direction :initform :north)
(strength :initform (make-stat :base 50))
- (movement-cost :initform (make-stat :base 8))
+ (movement-cost :initform (make-stat :base 14))
(tile :initform "rook")
(target :initform nil)
- (hit-points :initform (make-stat :base 40 :min 0 :max 40))
+ (hit-points :initform (make-stat :base 16 :min 0 :max 40))
(description :initform
"The Rook is a cargo lifter modified to chase and bomb a target.
Hard to kill because of their evasive manuevers."))
(define-method run rook ()
+ [expend-action-points self 1]
(ecase <behavior>
(:seeking [seek self])
(:fleeing [flee self])))
+(define-method hit rook (&optional object)
+ [play-sample self "yelp"]
+ [damage self 1])
+
(define-method die rook ()
- [drop self (clone =repair-module=)]
[play-sample self "blaagh2"]
[parent>>die self])
View
4 cons/player.lisp
@@ -79,6 +79,10 @@
[play-sample self "ouch"]
[damage self 1])
+(define-method damage agent (points)
+ (message "DAMAGE OF ~S" points)
+ [parent>>damage self points])
+
(define-method pause agent ()
[pause *world*])
View
90 cons/security.lisp
@@ -0,0 +1,90 @@
+(in-package :cons-game)
+
+(defcell security-crate
+ (name :initform "Security storage crate")
+ (categories :initform '(:obstacle :opaque :pushable :destructible :target))
+ (hit-points :initform (make-stat :base 10 :min 0))
+ (tile :initform "crate"))
+
+(define-method die security-crate ()
+ (percent-of-time 50
+ [drop self (ecase (random 3)
+ (0 (clone =health=))
+ (1 (clone =health=))
+ (3 (clone =red-key=)))])
+ [drop self (clone =crate-debris=)]
+ [parent>>die self])
+
+(define-method hit security-crate (&optional hitter)
+ [play-sample self "bip"]
+ [damage self 1])
+
+;;; Security world generation
+
+(define-prototype security (:parent =sector=)
+ (description :initform "Data security.")
+ (floor :initform "security-background")
+ (barrier :initform "security-foreground")
+ (accent :initform "security-accent")
+ (height :initform 50)
+ (width :initform 50)
+ (ambient-light :initform :total)
+ (required-modes :initform nil)
+ (scale :initform '(1 xm))
+ (edge-condition :initform :block)
+ (grammar :initform
+ '((world >> (:pushloc
+ 25 :jump
+ 90 :right
+ 35 :jump
+ =exit= :color :drop
+ :poploc
+ 90 :right
+ 5 :jump
+ 90 :left
+ 6 :jump
+ :pushloc room-row :poploc
+ 90 :right 8 :jump 90 :left
+ 90 :right 90 :right 8 :jump 90 :left 90 :left
+ :pushloc room-row :poploc
+ 90 :right 8 :jump 90 :left
+ 90 :left 90 :left 8 :jump 90 :right 90 :right
+ :pushloc room-row :poploc
+ 90 :right 8 :jump 90 :left))
+ (drop-rook >> (:push-color :pushloc
+ =rook= :color
+ 90 :right 1 :jump
+ 1 :draw :poploc :color))
+ (room-row >> (10 :jump
+ :pushloc room :poploc
+ 10 :jump
+ :pushloc room :poploc))
+ (random-crate >> =crate= =crate= =security-crate=)
+ (crate-to-right >> (:push-color :pushloc
+ random-crate :color
+ 90 :right
+ 1 :jump
+ 1 :draw
+ :poploc :color))
+ (shocker-maybe >> :noop :noop (=shocker= :color :drop))
+ (random-turn >> :right :left)
+ (room >> (=barrier= :color
+ 8 :draw
+ 90 :right
+ 4 :draw
+ 2 :jump
+ 2 :draw
+ 90 :right
+ 2 :draw
+ crate-to-right
+ 1 :draw
+ crate-to-right
+ 1 :draw
+ crate-to-right
+ 4 :draw
+ 90 :right
+ 4 :draw drop-rook)))))
+
+(define-method begin-ambient-loop security ()
+ (play-music "purity" :loop t))
+
View
19 cons/things.lisp
@@ -42,7 +42,7 @@
(tile :initform "explosion")
(speed :initform (make-stat :base 4))
(damage-per-turn :initform 10)
- (clock :initform 2))
+ (clock :initform 6))
(define-method run explosion ()
(if (zerop <clock>)
@@ -52,7 +52,7 @@
(percent-of-time 30 [play-sample self "crunch"])
(decf <clock>)
(percent-of-time 80 [move self (random-direction)])
- [expend-action-points self 20]
+ [expend-action-points self 10]
(xe2:do-cells (cell [cells-at *world* <row> <column>])
[damage cell <damage-per-turn>]))))
@@ -125,7 +125,15 @@
(prog1 nil
(when (and (< (random 100) probability)
[in-bounds-p *world* r c])
- [drop-cell *world* (clone =explosion=) r c :no-collisions nil]))))
+ [drop-cell *world* (clone =explosion=) r c :no-collisions nil])))
+ (damage (r c &optional (probability 100))
+ (prog1 nil
+ (when (and (< (random 100) probability)
+ [in-bounds-p *world* r c])
+ (do-cells (cell [cells-at *world* r c])
+ (if [is-player cell]
+ [damage cell 4]
+ [hit cell self]))))))
(dolist (dir xe2:*compass-directions*)
(multiple-value-bind (r c)
(step-in-direction <row> <column> dir)
@@ -135,6 +143,11 @@
(- <row> 2)
(- <column> 2)
5 5)
+ ;; definitely damage everything in radius
+ (trace-rectangle #'damage
+ (- <row> 2)
+ (- <column> 2)
+ 5 5 :fill)
(dotimes (n (+ 10 (random 10)))
[drop self (clone =plasma=)])
(labels ((do-circle (image)

0 comments on commit a1ac749

Please sign in to comment.