implement level 5's timed switch
This commit is contained in:
parent
b25bd7d41a
commit
647cbb23b4
|
@ -181,6 +181,8 @@
|
||||||
(when self.iobject
|
(when self.iobject
|
||||||
(self:draw-object-editor (+ x (* tilew mapw) 10) y))
|
(self:draw-object-editor (+ x (* tilew mapw) 10) y))
|
||||||
(set y (+ y (* tileh maph) 10))
|
(set y (+ y (* tileh maph) 10))
|
||||||
|
(set self.level.tickword (textfield self "Tick word" self.level.tickword x y 100 200))
|
||||||
|
(set y (+ y 30))
|
||||||
(when (checkbox self "Edit objects" (= self.itile nil) x y)
|
(when (checkbox self "Edit objects" (= self.itile nil) x y)
|
||||||
(set self.itile nil)
|
(set self.itile nil)
|
||||||
(set self.playerpos nil))
|
(set self.playerpos nil))
|
||||||
|
|
|
@ -169,8 +169,9 @@
|
||||||
; hotswap-safe debug stub at root of call stack
|
; hotswap-safe debug stub at root of call stack
|
||||||
; but REPL debug stub should be very available as a task
|
; but REPL debug stub should be very available as a task
|
||||||
|
|
||||||
; 20x12 means full map is 240 bytes - we have an extra 16 bytes at the end to mess with?
|
(vm:word :handle-key :tick :read-key :player-key :hide-footer)
|
||||||
(vm:word :handle-key :read-key :player-key :hide-footer)
|
(vm:word :tick :map-specific-tick)
|
||||||
|
|
||||||
(vm:word :load-level
|
(vm:word :load-level
|
||||||
:lit :map-jaye-yx :get :jaye-yx :set
|
:lit :map-jaye-yx :get :jaye-yx :set
|
||||||
:lit :map-neut-yx :get :neut-yx :set
|
:lit :map-neut-yx :get :neut-yx :set
|
||||||
|
|
|
@ -3,4 +3,16 @@
|
||||||
(local level (deflevel "game/map5.json"))
|
(local level (deflevel "game/map5.json"))
|
||||||
(local vm level.vm)
|
(local vm level.vm)
|
||||||
|
|
||||||
|
(vm:var :doortimer 0)
|
||||||
|
(vm:word :start-doortimer 0x100 :doortimer :set)
|
||||||
|
(vm:word :doortimer-tick
|
||||||
|
:doortimer :get (vm:when
|
||||||
|
:doortimer :get 1 :- :dup :doortimer :set
|
||||||
|
:not (vm:when
|
||||||
|
:lit :timedswitch ev.deact :entity>do)))
|
||||||
|
|
||||||
|
(vm:word :do-timedswitch
|
||||||
|
; only gord is physically able to touch it
|
||||||
|
:dup ev.touch := (vm:when :start-doortimer :drop ev.act) :switch)
|
||||||
|
|
||||||
level
|
level
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"neut":{"y":6,"x":20},"jaye":{"y":5,"x":19},"gord-following":true,"map":"21616161228161616161616161616161616162612102E0C0C0C0C0E0C04361C0C0C0C0C0A3C0C0612161C0C0C0C0C0C0C0C022C0C0C08282C0828261416103C0C0C0C0C0C0C081C0C0C0C0C0C0C0C2C1210203C0C0C0C0C0C04361C0C0C08282838282622161616161816161616161618161616161616161216163C0C0C0C0E0C0C06143C0C0C0C0C0C063612102C0C0C0C0C0C0C0C061C0C0C0C0C0C0C0C0814161C0C0C0C0E2C0E2836101C0C0C0C0C0C0C0C1216143C0C0C082A2A2A281C0C0C043034382E26121610261610261C16102616161026161610261612121212121214121212121212121214121212121","objects":[{"x":17,"func":"rexx","linkword":"","name":"","y":11},{"x":17,"func":"rexx","linkword":"","name":"","y":8},{"x":20,"link":13,"func":"switch","linkword":"","name":"","y":9},{"x":20,"link":16,"func":"switch","linkword":"","name":"","y":4},{"x":12,"link":9,"func":"term","linkword":"","name":"","y":4},{"x":10,"func":"rexx","linkword":"","name":"","y":4},{"x":8,"link":17,"func":"switch","linkword":"","name":"","y":2},{"x":8,"link":10,"func":"term","linkword":"","name":"","y":6},{"x":8,"link":5,"func":"term","linkword":"","name":"","y":11},{"x":3,"link":8,"func":"term","linkword":"","name":"","y":11},{"x":5,"link":12,"func":"scan","linkword":"","name":"","y":12},{"x":6,"func":"door","linkword":"","name":"","y":12},{"x":6,"func":"door","linkword":"","name":"","y":7},{"x":11,"func":"door","linkword":"","name":"","y":9},{"x":11,"link":14,"func":"scan","linkword":"","name":"","y":10},{"x":13,"func":"door","linkword":"","name":"","y":7},{"x":11,"func":"door","linkword":"","name":"","y":3}]}
|
{"neut":{"y":6,"x":20},"map":"21616161228161616161616161616161616162612102E0C0C0C0C0E0C04361C0C0C0C0C0A3C0C0612161C0C0C0C0C0C0C0C022C0C0C08282C0828261416103C0C0C0C0C0C0C081C0C0C0C0C0C0C0C2C1210203C0C0C0C0C0C04361C0C0C08282838282622161616161816161616161618161616161616161216163C0C0C0C0E0C0C06143C0C0C0C0C0C063612102C0C0C0C0C0C0C0C061C0C0C0C0C0C0C0C0814161C0C0C0C0E2C0E2836101C0C0C0C0C0C0C0C1216143C0C0C082A2A2A281C0C0C043034382E26121610261610261C16102616161026161610261612121212121214121212121212121214121212121","jaye":{"y":5,"x":19},"tickword":"doortimer-tick","gord-following":true,"objects":[{"x":17,"func":"rexx","y":11,"linkword":"","name":""},{"x":17,"func":"rexx","y":8,"linkword":"","name":""},{"link":13,"y":9,"func":"do-timedswitch","name":"timedswitch","linkword":"","x":20},{"link":16,"y":4,"func":"switch","name":"","linkword":"","x":20},{"link":9,"y":4,"func":"term","name":"","linkword":"","x":12},{"x":10,"func":"rexx","y":4,"linkword":"","name":""},{"link":17,"y":2,"func":"switch","name":"","linkword":"","x":8},{"link":10,"y":6,"func":"term","name":"","linkword":"","x":8},{"link":5,"y":11,"func":"term","name":"","linkword":"","x":8},{"link":8,"y":11,"func":"term","name":"","linkword":"","x":3},{"link":12,"y":12,"func":"scan","name":"","linkword":"","x":5},{"x":6,"func":"door","y":12,"linkword":"","name":""},{"x":6,"func":"door","y":7,"linkword":"","name":""},{"x":11,"func":"door","y":9,"linkword":"","name":""},{"link":14,"y":10,"func":"scan","name":"","linkword":"","x":11},{"x":13,"func":"door","y":7,"linkword":"","name":""},{"x":11,"func":"door","y":3,"linkword":"","name":""}]}
|
|
@ -39,13 +39,15 @@
|
||||||
(fn encode-yx [xy]
|
(fn encode-yx [xy]
|
||||||
(if xy (bit.bor (bit.lshift (- xy.y 1) 8) (- xy.x 1)) 0xffff))
|
(if xy (bit.bor (bit.lshift (- xy.y 1) 8) (- xy.x 1)) 0xffff))
|
||||||
|
|
||||||
|
; 20x12 means full map is 240 bytes - we have an extra 16 bytes at the end for metadata
|
||||||
(fn append-map [map org]
|
(fn append-map [map org]
|
||||||
(org:append
|
(org:append
|
||||||
:map [:bytes (map.map:fromhex)]
|
:map [:bytes (map.map:fromhex)]
|
||||||
:map-entity-count [:db (length map.objects)]
|
:map-entity-count [:db (length map.objects)]
|
||||||
:map-jaye-yx [:dw (encode-yx map.jaye)]
|
:map-jaye-yx [:dw (encode-yx map.jaye)]
|
||||||
:map-neut-yx [:dw (encode-yx map.neut)]
|
:map-neut-yx [:dw (encode-yx map.neut)]
|
||||||
:map-gord-yx [:dw (if map.gord-following (encode-yx map.jaye) 0xffff)]))
|
:map-gord-yx [:dw (if map.gord-following (encode-yx map.jaye) 0xffff)]
|
||||||
|
:map-specific-tick [:jmp (if (= (or map.tickword "") "") :next map.tickword)]))
|
||||||
|
|
||||||
(fn find-itile [tiles label ?itilenext]
|
(fn find-itile [tiles label ?itilenext]
|
||||||
(local itile (or ?itilenext 1))
|
(local itile (or ?itilenext 1))
|
||||||
|
|
8
todo.txt
8
todo.txt
|
@ -2,8 +2,14 @@ Game:
|
||||||
* Neut tileset
|
* Neut tileset
|
||||||
* level loading
|
* level loading
|
||||||
* Rexx can run over Jaye and vice versa
|
* Rexx can run over Jaye and vice versa
|
||||||
* drawing queue
|
* drawing queue (tile index = priority?)
|
||||||
|
* Title screen
|
||||||
|
* Ending screen
|
||||||
|
|
||||||
tooling ideas:
|
tooling ideas:
|
||||||
|
* rearrange tile order, preserving maps
|
||||||
|
* (needed for Neut tileset? or special neut-ified versions of _everything_?)
|
||||||
* REPLy buffer (Polywell?)
|
* REPLy buffer (Polywell?)
|
||||||
|
* save player positions & map state during hot reload
|
||||||
|
* debug movement (noclip? teleport? activate by clicking? MAME supports mouse input / debug overlays...)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue