I've been working on an experimental compiler specifically for making microgames with, where you define a map, define a list of actors, place the actors on the map in locations and describe the behavior of the actors, primarily through chaining together premade behaviors.
So far it's actually looking pretty feasible? I've got things to the point where this:
Code: Select all
"player": {
"graphic": "$01",
"size": [16, 16],
"run": [
["set", "speed", 2],
["8way-movement", 255]
]
},
"getme": {
"graphic": "$e8",
"size": [16, 16],
"run": [
["set", "speed", 1],
["ball-movement"],
{
"if": ["touching-type", "actor:player"],
"then": [
["destroy"],
{
"if": ["not", "find-type", "actor:getme"],
"then": [
["win-game"]
]
}
]
}
]
},
Code: Select all
.proc actor_run_player
lda #2
sta ActorSpeed,x
lda #255
jsr Actor8WayMovement
Exit:
rts
.endproc
.proc actor_run_getme
lda #1
sta ActorSpeed,x
jsr ActorBallMovement
lda #ActorTypes::player
jsr ActorTouchingType
jcc lbl_12
lda #0
sta ActorType,x
lda #ActorTypes::getme
jsr ActorFindType
jcs lbl_14
jsr WinGame
lbl_14:
lbl_12:
Exit:
rts
.endproc
I guess the question is, is this worth doing? Expressing it through JSON like this doesn't really seem that much easier than just writing the instructions yourself, though it could probably benefit from being able to accept a file that's in more convenient-to-write form, where you could add comments. I'm not really interested in making a GUI editor for this, but maybe an existing one could be tweaked to work with this?