Basically final dump before jam ends

This commit is contained in:
Bill Niblock 2024-11-03 18:08:43 -05:00
parent fd96d53a34
commit ff214a11ad
10 changed files with 121 additions and 41 deletions

View file

@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 74 98">
<defs>
<linearGradient id="b">
<stop offset="0" style="stop-color:#2ca02c;stop-opacity:1"/>
<stop offset="1" style="stop-color:#000;stop-opacity:1"/>
</linearGradient>
<linearGradient id="a">
<stop offset="0" style="stop-color:#fff3d7;stop-opacity:1"/>
<stop offset="1" style="stop-color:#000;stop-opacity:1"/>
</linearGradient>
<linearGradient xlink:href="#a" id="f" x1="54.093" x2="79.963" y1="250.01" y2="312.663" gradientTransform="matrix(1.18182 0 0 1.4375 -19.242 -86.943)" gradientUnits="userSpaceOnUse"/>
<linearGradient xlink:href="#b" id="e" x1="-5.479" x2="15.89" y1="221.294" y2="254.971" gradientTransform="matrix(1.30365 0 0 1.18444 -13.522 -37.404)" gradientUnits="userSpaceOnUse"/>
<linearGradient xlink:href="#b" id="d" x1="-5.479" x2="6.417" y1="221.294" y2="241.667" gradientTransform="matrix(.95076 0 0 .83982 73.99 37.962)" gradientUnits="userSpaceOnUse"/>
<linearGradient xlink:href="#b" id="c" x1="-5.479" x2="20.366" y1="221.294" y2="237.725" gradientTransform="matrix(.945 0 0 .88681 166.162 -47.893)" gradientUnits="userSpaceOnUse"/>
</defs>
<g transform="translate(0 -199)">
<path d="M160.984 133.102h11.251v30.503h-11.251z" style="fill:url(#c);fill-opacity:1;stroke-width:3.01006447;stroke:#444;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" transform="matrix(.79973 .60036 -.5041 .86365 0 0)"/>
<path d="M68.781 209.366h11.32v28.886h-11.32z" style="fill:url(#d);fill-opacity:1;stroke-width:3.00055975;stroke:#444;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" transform="matrix(.99547 .09512 -.12227 .9925 0 0)"/>
<path d="M-20.665 204.337h15.522v40.74h-15.522z" style="fill:url(#e);fill-opacity:1;stroke-width:3.000803;stroke:#444;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" transform="matrix(.98899 -.148 .18028 .98362 0 0)"/>
<ellipse cx="37.042" cy="263.927" rx="34.396" ry="30.427" style="fill:url(#f);fill-opacity:1;stroke-width:3;stroke:#444;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"/>
<path d="M29.104 263.927a7.937 11.906 0 0 1-7.726 11.902 7.937 11.906 0 0 1-8.138-11.267 7.937 11.906 0 0 1 7.292-12.503 7.937 11.906 0 0 1 8.527 10.6m31.795 1.268a7.937 11.906 0 0 1-7.726 11.902 7.937 11.906 0 0 1-8.138-11.267 7.937 11.906 0 0 1 7.292-12.503 7.937 11.906 0 0 1 8.527 10.6" style="fill:#444;fill-opacity:1;stroke-width:.56126553"/>
<path d="M21.167 261.281a2.646 3.969 0 0 1-2.576 3.968 2.646 3.969 0 0 1-2.712-3.756 2.646 3.969 0 0 1 2.43-4.168 2.646 3.969 0 0 1 2.843 3.533m31.765.423a2.646 3.969 0 0 1-2.576 3.968 2.646 3.969 0 0 1-2.712-3.756 2.646 3.969 0 0 1 2.43-4.168 2.646 3.969 0 0 1 2.843 3.533" style="fill:#fff;fill-opacity:1;stroke-width:.21603146"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
assets/images/logos/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
assets/images/logos/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -1,4 +1,8 @@
(local state (require :state))
; ; ### Use seed to randomize stuff
(love.math.setRandomSeed (state.getSeed))
; Cell Stuff
; The "cell-num" is the number of cells across; it is then squared to make the
; grid. Each cell has a "cell-size" of walls ("wall-width") and hallways
@ -8,7 +12,7 @@
(var (hall-width wall-width) (values (. map-meta :h) (. map-meta :w)))
(var cell-size (+ hall-width wall-width))
; (fn wall-seg [] (+ 10 (math.random 1 3)))
(fn wall-seg [] (math.random 11 13))
(fn wall-seg [] (love.math.random 11 13))
; Helper functions for dealing with the cell list
(fn cell-row [i] (+ 1 (math.floor (/ (- i 1) cell-num))))
(fn map-index [i]
@ -17,8 +21,9 @@
(- (* cell-col cell-size) (- cell-size 1))))
; Meta-Cells is the data before the digits
(var spawn-cell (math.random 1 cell-num))
(var leave-cell (math.random (+ (* cell-num (- cell-num 1)) 1) (* cell-num cell-num)))
(var spawn-cell (love.math.random 1 cell-num))
(var leave-cell (love.math.random
(+ (* cell-num (- cell-num 1)) 1) (* cell-num cell-num)))
(var spawn-spot
{:x cell-size
:y (+ (- (* spawn-cell cell-size) (- cell-size 1)) cell-size)})
@ -94,7 +99,7 @@
(var chosen-next-cell {})
(when (> (length next-cells) 0)
(table.insert cell-stack current-cell)
(set chosen-next-cell (. next-cells (math.random 1 (length next-cells))))
(set chosen-next-cell (. next-cells (love.math.random 1 (length next-cells))))
; Adjust walls accordingly
(case chosen-next-cell
{:d 1} (tset meta-cells (. chosen-next-cell :c) :s true)
@ -173,9 +178,10 @@
(fn print_map [map]
(for [i 1 (length map)]
(var r "")
(var (r o) (values "" ""))
(for [j 1 (length (. map i))]
(set r (.. r " " (. map i j))))
(set o (if (= 0 (. map i j)) "00" (. map i j)))
(set r (.. r " " o)))
(print r)))
(fn generate []
@ -183,7 +189,7 @@
(var data-maze (convert-cells meta-maze leave-cell))
(var data-map (generate_cell_map data-maze))
(var map (generate_map data-map spawn-cell leave-cell))
;(print_map map)
(print_map map)
(values map spawn-spot))
; (print (.. "SPAWN: " spawn-cell "(" (. spawn-spot :x) "," (. spawn-spot :y) ")"))

View file

@ -1,3 +1,4 @@
(local state (require :state))
(var (screen-width screen-height) (love.window.getMode))
(var (mx my) (values (/ screen-width 2) (/ screen-height 2)))
(love.mouse.setGrabbed false)
@ -5,12 +6,23 @@
(love.graphics.setNewFont 30)
(var ticks 0)
;; Start screen logos
(var screen-logos [])
(var screen-logo-files (love.filesystem.getDirectoryItems "assets/images/logos"))
(each [_ v (ipairs screen-logo-files)]
(local logo {})
(tset logo :i (love.graphics.newImage (.. "assets/images/logos/" v)))
(var imgdata (love.image.newImageData (.. "assets/images/logos/" v)))
(tset logo :w (imgdata:getWidth))
(tset logo :h (imgdata:getHeight))
(table.insert screen-logos logo))
(var footer-font (love.graphics.newFont 19))
(var footer-font (love.graphics.newFont 11))
(local (major minor revision) (love.getVersion))
(fn helmet-hud []
(love.graphics.setColor 0 1 0 0.25)
(love.graphics.setColor 0 1 1 1)
(love.graphics.line 0 0
(+ (/ screen-width 6) 0) 35
(+ (/ screen-width 3) 0) 30
@ -19,43 +31,74 @@
screen-width 0))
(var menu-font (love.graphics.newFont 20))
(fn menu-button [x y t]
(love.graphics.polygon "line" x y
(fn menu-button [x y t la ra sa]
(love.graphics.polygon "line" (- x 100) y
(+ x 100) y
(+ x 120) (+ y 20)
(+ x 150) (+ y 20)
(+ x 100) (+ y 40)
x (+ y 40)
(- x 20) (+ y 20))
(love.graphics.printf t x (+ y 11) (+ x 100))
)
(- x 100) (+ y 40)
(- x 150) (+ y 20))
(love.graphics.printf t (- x 109) (+ y 3) (+ x 100)))
(var show-logos true)
(var (screen-show logo-idx fade-time fade-mod) (values 0 1 0 1))
(fn reset-logo-timers []
(set screen-show 0)
(set fade-time 0)
(set fade-mod 1))
(fn show-logo [x]
(var logo (. screen-logos x))
(if
(< screen-show 5)
(do
(love.graphics.setColor 0 1 1 fade-time)
(love.graphics.draw (. logo :i)
(- (/ screen-width 2) (/ (. logo :w) 2))
(- (/ screen-height 2) (/ (. logo :h) 2))))
; else
(do
(if (. screen-logos (+ x 1))
(set logo-idx (+ x 1))
; else
(set show-logos false))
(reset-logo-timers))))
{
:draw
(fn draw []
(helmet-hud)
(menu-button (- (/ screen-width 2) 50) 100 (.. mx ", " my))
; (love.graphics.setNewFont 50)
; (love.graphics.setColor 0.75 0.75 0.75)
; (love.graphics.printf "L4-N-DER Training Simulator" 0
; (- (/ screen-height 2) 100) screen-width :center)
; (love.graphics.setNewFont 20)
; (love.graphics.setColor 0.55 0.55 0.05)
; (love.graphics.printf "OFFICIAL LANDER EYES ONLY" 0
; (- (/ screen-height 2) 20) screen-width :center)
; (love.graphics.setColor 0.75 0.75 0.75)
; (love.graphics.printf "Press D To Deploy" 0
; (+ (/ screen-height 2) 20) screen-width :center)
; (love.graphics.printf "Press Q To Quit" 0
; (+ (/ screen-height 2) 40) screen-width :center)
(love.graphics.printf
(: "Made with Love [%s.%s.%s] and Fennel"
:format major minor revision) footer-font 20 (- screen-height 30) screen-width :left)
(love.graphics.printf "A game by Bill Niblock" footer-font -20 (- screen-height 30) screen-width :right)
(if
show-logos
(show-logo logo-idx)
(do
(helmet-hud)
(menu-button (/ screen-width 2) 100 "S U R V I V O R")
(love.graphics.printf "Press P to Play"
0 (+ (/ screen-height 2) 100)
screen-width :center)
(love.graphics.printf "Press Q to Quit"
0 (+ (/ screen-height 2) 150)
screen-width :center)
(love.graphics.printf
(: "Made with Love [%s.%s.%s] and Fennel"
:format major minor revision) footer-font 20 (- screen-height 30) screen-width :left)
(love.graphics.printf "A game by Bill Niblock" footer-font -20 (- screen-height 30) screen-width :right)))
)
:update
(fn update [dt]
(set ticks (+ ticks dt))
(when (> fade-time 2)
(set fade-mod -1))
(set fade-time (+ fade-time (* fade-mod dt)))
(when (> ticks 1)
(set ticks (- ticks 1))
(set screen-show (+ screen-show 1))))
:keypressed
(fn keypressed [key set-mode]
(when (= key "d")
(when (= key "p")
(var newseed (+ (love.timer.getTime) mx my))
(state.setSeed newseed)
(set-mode :mode-play))
(when (= key "q")
(love.event.quit)))

View file

@ -295,7 +295,6 @@
)
:keypressed (fn keypressed [k]
(when (= k "o") (state.modO -1))
(when (= k "x") (love.event.quit))
(when (= k "q") (love.event.quit))
)
}

View file

@ -274,3 +274,7 @@ left-action, right-action, and select-action.
There should also be a way to navigate with the keyboard. Using up and down
arrows or keys will move the "selected" button, left/right arrows/keys will
activate the left/right actions, and enter/use will activate the select action.
Start simple, make the polygon a square, make the areas square. Add buttons for
survivors and supplies and monster and stuff, even though it's not implemented
yet.

View file

@ -56,7 +56,7 @@
; This draws barriers around the screen
; Eventually to be improved into a helmet
(fn helmet-hud []
(love.graphics.setColor 0 1 0 0.25)
(love.graphics.setColor 0 1 1 0.25)
(love.graphics.line 0 0
(+ (/ screen-width 6) 0) 35
(+ (/ screen-width 3) 0) 30
@ -98,7 +98,7 @@
(> (+ c n) (length l)) 1
(+ c n)))
(fn compass-bar []
(love.graphics.setColor 0 1 0 0.25)
(love.graphics.setColor 0 1 1 0.25)
(var (hc-output hc-padding) (values "" " "))
(var hc-idx (math.floor (+ 10 (* 10 (player.getDirX)))))
(var hc-idx-mod 1)

View file

@ -1,6 +1,8 @@
; Handles game-play stateful information
(local pi math.pi)
(var game {:seed 14921215311})
; The Player table holds all the player stuff
; [x y] coordinates, [d] distance
; [dx dy] direction vector
@ -14,7 +16,9 @@
; [h w] hall and wall widths
(var map {:n 10 :h 2 :w 2})
{:getPlayer (fn getPlayer [] player)
{:getSeed (fn getSeed [] game.seed)
:setSeed (fn setSeed [x] (set game.seed x))
:getPlayer (fn getPlayer [] player)
:getX (fn getX [] player.x)
:setX (fn setX [x] (set player.x x))
:getY (fn getY [] player.y)