add networking, 3d improvements, reorganize src structure
This commit is contained in:
parent
39b604b333
commit
415d424057
122 changed files with 5358 additions and 721 deletions
|
|
@ -1,7 +1,7 @@
|
|||
(local pxl8 (require :pxl8))
|
||||
(local menu (require :mod.menu))
|
||||
(local music (require :mod.music))
|
||||
(local worldgen (require :mod.worldgen))
|
||||
(local first_person3d (require :mod.first_person3d))
|
||||
|
||||
(var time 0)
|
||||
(var active-demo :logo)
|
||||
|
|
@ -34,13 +34,12 @@
|
|||
(set particles (pxl8.create_particles 1000))
|
||||
(set particles2 (pxl8.create_particles 500))
|
||||
(music.init)
|
||||
(music.start)
|
||||
(worldgen.init)))
|
||||
(first_person3d.init)))
|
||||
|
||||
(global update (fn [dt]
|
||||
(when (pxl8.key_pressed "escape")
|
||||
(menu.toggle)
|
||||
(when (= active-demo :worldgen)
|
||||
(when (= active-demo :first_person3d)
|
||||
(pxl8.set_relative_mouse_mode (not (menu.is-paused)))))
|
||||
|
||||
(when (not (menu.is-paused))
|
||||
|
|
@ -50,9 +49,9 @@
|
|||
(transition:update dt)
|
||||
(when (transition:is_complete)
|
||||
(when transition-pending
|
||||
(when (and (= active-demo :worldgen) (not= transition-pending :worldgen))
|
||||
(when (and (= active-demo :first_person3d) (not= transition-pending :first_person3d))
|
||||
(pxl8.set_relative_mouse_mode false))
|
||||
(when (and (not= active-demo :worldgen) (= transition-pending :worldgen))
|
||||
(when (and (not= active-demo :first_person3d) (= transition-pending :first_person3d))
|
||||
(pxl8.set_relative_mouse_mode true))
|
||||
(set active-demo transition-pending)
|
||||
(set transition-pending nil)
|
||||
|
|
@ -69,12 +68,14 @@
|
|||
(when (pxl8.key_pressed "5") (switch-demo :fire))
|
||||
(when (pxl8.key_pressed "6") (switch-demo :rain))
|
||||
(when (pxl8.key_pressed "7") (switch-demo :snow))
|
||||
(when (pxl8.key_pressed "8") (switch-demo :worldgen))
|
||||
(when (pxl8.key_pressed "8") (switch-demo :first_person3d))
|
||||
(when (pxl8.key_pressed "=")
|
||||
(set use-famicube-palette? (not use-famicube-palette?))
|
||||
(local palette-path (if use-famicube-palette? "res/palettes/famicube.ase" "res/sprites/pxl8_logo.ase"))
|
||||
(pxl8.load_palette palette-path))
|
||||
|
||||
(music.update dt)
|
||||
|
||||
(case active-demo
|
||||
:logo (do
|
||||
(set logo-x (+ logo-x (* logo-dx dt)))
|
||||
|
|
@ -91,9 +92,7 @@
|
|||
(when (> logo-y 296)
|
||||
(set logo-y 296)
|
||||
(set logo-dy (- (math.abs logo-dy)))))
|
||||
:worldgen (worldgen.update dt))
|
||||
|
||||
(music.update dt)
|
||||
:first_person3d (first_person3d.update dt))
|
||||
|
||||
(when particles
|
||||
(particles:update dt))
|
||||
|
|
@ -173,7 +172,7 @@
|
|||
(set snow-init? true))
|
||||
(particles:render)))
|
||||
|
||||
:worldgen (worldgen.frame)
|
||||
:first_person3d (first_person3d.frame)
|
||||
|
||||
_ (pxl8.clear 0))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue