add town overworld
This commit is contained in:
parent
f16962f7f9
commit
bddfcec05a
11
game.jor
11
game.jor
|
@ -94,8 +94,10 @@ defer player-touch ( x y -- b )
|
||||||
: try-move-entity ( e -- )
|
: try-move-entity ( e -- )
|
||||||
dup entity-dst check-entity-touch not if move-entity then ;
|
dup entity-dst check-entity-touch not if move-entity then ;
|
||||||
|
|
||||||
var queued-level
|
var q-level
|
||||||
: queue-level queued-level ! ;
|
var q-player.x
|
||||||
|
var q-player.y
|
||||||
|
: queue-level q-level ! q-player.y ! q-player.x ! ;
|
||||||
|
|
||||||
player :tick
|
player :tick
|
||||||
0 ^LEFT key-down if drop 1 W player entity.dir ! then
|
0 ^LEFT key-down if drop 1 W player entity.dir ! then
|
||||||
|
@ -116,9 +118,10 @@ player :tick
|
||||||
' hello-world JOB send
|
' hello-world JOB send
|
||||||
then
|
then
|
||||||
tick-debounce
|
tick-debounce
|
||||||
queued-level @ dup if
|
q-level @ dup if
|
||||||
0 queue-level
|
0 q-level !
|
||||||
loadlevel
|
loadlevel
|
||||||
|
q-player.x @ q-player.y @ tile>world player entity.pos!
|
||||||
else drop then ;
|
else drop then ;
|
||||||
|
|
||||||
' mode-move MODE-MOVE !
|
' mode-move MODE-MOVE !
|
||||||
|
|
|
@ -22,6 +22,7 @@ s" game.jor" loadfile
|
||||||
|
|
||||||
intern pete.jor
|
intern pete.jor
|
||||||
intern petehous.jor
|
intern petehous.jor
|
||||||
|
intern road.jor
|
||||||
|
|
||||||
:noname loadfile ; checkpoint _loadlevel
|
:noname loadfile ; checkpoint _loadlevel
|
||||||
' _loadlevel ' loadlevel redefine
|
' _loadlevel ' loadlevel redefine
|
||||||
|
|
5
map.jor
5
map.jor
|
@ -13,7 +13,7 @@ var tileselect
|
||||||
|
|
||||||
array tileflags
|
array tileflags
|
||||||
( grass ) WALKABLE b,
|
( grass ) WALKABLE b,
|
||||||
( dirt ) WALKABLE b,
|
( dirt ) WALKABLE DRIVABLE | b,
|
||||||
( water ) 0 b,
|
( water ) 0 b,
|
||||||
( pavement ) WALKABLE DRIVABLE | b,
|
( pavement ) WALKABLE DRIVABLE | b,
|
||||||
( brick ) 0 b,
|
( brick ) 0 b,
|
||||||
|
@ -29,6 +29,7 @@ array tileflags
|
||||||
( fridge ) 0 b,
|
( fridge ) 0 b,
|
||||||
( countertop ) 0 b,
|
( countertop ) 0 b,
|
||||||
( sink ) 0 b,
|
( sink ) 0 b,
|
||||||
|
( house ) 0 b,
|
||||||
|
|
||||||
here tileflags - 1 - const MAXTILE
|
here tileflags - 1 - const MAXTILE
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ here tileflags - 1 - const MAXTILE
|
||||||
MOUSEL mousedown if tileselect @ mousetile tile b! invalidate-map then
|
MOUSEL mousedown if tileselect @ mousetile tile b! invalidate-map then
|
||||||
MOUSER clicked if
|
MOUSER clicked if
|
||||||
mouseworldpos world>tile
|
mouseworldpos world>tile
|
||||||
2dup tile b@ dup tileselect ! .
|
2dup tile b@ tileselect !
|
||||||
swap . . cr then ;
|
swap . . cr then ;
|
||||||
|
|
||||||
: copy-mapseg ( neww oldw y -- )
|
: copy-mapseg ( neww oldw y -- )
|
||||||
|
|
19
pete.jor
19
pete.jor
|
@ -12,13 +12,18 @@ car :touch
|
||||||
player.driving? not if car yield then
|
player.driving? not if car yield then
|
||||||
0 |; ' entities redefine
|
0 |; ' entities redefine
|
||||||
|
|
||||||
:| touch-begin S leaving? player.driving? not and dup if
|
:| touch-begin S leaving? dup
|
||||||
pete say" It's too far to walk to town." then
|
if player.driving? not
|
||||||
touch-next 12 7 2= dup if
|
if pete say" It's too far to walk to town."
|
||||||
player.driving? not if
|
else 5 10 road.jor queue-level
|
||||||
petehous.jor queue-level
|
then
|
||||||
then then
|
then
|
||||||
|
touch-next 13 8 2= player.driving? and dup
|
||||||
|
if 0 player.state DRIVING f!
|
||||||
|
12 8 tile>world player entity.pos!
|
||||||
|
then
|
||||||
|
touch-next 12 7 2= player.driving? not and dup
|
||||||
|
if 16 9 petehous.jor queue-level then
|
||||||
touch-last |; ' player-touch redefine
|
touch-last |; ' player-touch redefine
|
||||||
s" pete.map" load-map
|
s" pete.map" load-map
|
||||||
; ' onload redefine
|
; ' onload redefine
|
||||||
|
|
||||||
|
|
BIN
petehous.jim
BIN
petehous.jim
Binary file not shown.
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
:noname
|
:noname
|
||||||
reset-level
|
reset-level
|
||||||
16 9 tile>world player entity.pos!
|
|
||||||
:|
|
:|
|
||||||
touch-begin 16 10 2= dup if
|
touch-begin 16 10 2= dup if
|
||||||
12 8 tile>world player entity.pos!
|
12 8 pete.jor queue-level
|
||||||
pete.jor queue-level
|
|
||||||
then touch-next 9 4 2= dup if
|
then touch-next 9 4 2= dup if
|
||||||
pete say" The closet is a disaster.\I don't want to deal with that\right now."
|
pete say" The closet is a disaster.\I don't want to deal with that\right now."
|
||||||
then touch-next 11 4 2= dup if
|
then touch-next 11 4 2= dup if
|
||||||
|
|
20
road.jor
Executable file
20
road.jor
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
( O V E R W O R L D )
|
||||||
|
|
||||||
|
:noname
|
||||||
|
reset-level
|
||||||
|
1 player.state DRIVING f!
|
||||||
|
|
||||||
|
:|
|
||||||
|
touch-begin E leaving? dup
|
||||||
|
if pete say" It's 100 miles to the next town." then
|
||||||
|
touch-next 5 9 2= dup
|
||||||
|
if 13 12 pete.jor queue-level then
|
||||||
|
touch-next 13 6 2= dup
|
||||||
|
if pete say" Old hiking trail." then
|
||||||
|
touch-next 24 6 2= dup
|
||||||
|
if mary say" Welcome to my place, Pete!" then
|
||||||
|
touch-last |; ' player-touch redefine
|
||||||
|
s" road.map" load-map
|
||||||
|
|
||||||
|
; ' onload redefine
|
||||||
|
|
Loading…
Reference in a new issue