76 lines
1.5 KiB
Text
76 lines
1.5 KiB
Text
-- Written by Forge/AuthorCompile.singe. Edit by hand or in the editor; either is fine.
|
|
return {
|
|
layers = {
|
|
{ gravity = 1500, kind = "world2d" }
|
|
},
|
|
rooms = {
|
|
{
|
|
entities = {
|
|
{ id = "ground", type = "ground", x = 360, y = 440 },
|
|
{ id = "hero", type = "hero", x = 200, y = 420 },
|
|
{ id = "readout", type = "readout", x = 12, y = 12 }
|
|
},
|
|
name = "start",
|
|
tracks = {}
|
|
}
|
|
},
|
|
rules = {
|
|
{
|
|
act = {
|
|
{ "run", direction = -1, entity = "hero" }
|
|
},
|
|
note = "Run left",
|
|
on = "frame",
|
|
when = {
|
|
{ "keyHeld", key = "LEFT" }
|
|
}
|
|
},
|
|
{
|
|
act = {
|
|
{ "run", direction = 1, entity = "hero" }
|
|
},
|
|
note = "Run right",
|
|
on = "frame",
|
|
when = {
|
|
{ "keyHeld", key = "RIGHT" }
|
|
}
|
|
},
|
|
{
|
|
act = {
|
|
{ "jump", entity = "hero" }
|
|
},
|
|
note = "Jump, with ground underfoot",
|
|
on = "frame",
|
|
when = {
|
|
{ "keyHeld", key = "SPACE" },
|
|
{ "onGround", entity = "hero" }
|
|
}
|
|
},
|
|
{
|
|
act = {
|
|
{ "setText", entity = "readout", text = "\"score \" .. score" }
|
|
},
|
|
note = "The readout, every frame",
|
|
on = "frame"
|
|
}
|
|
},
|
|
title = "New game",
|
|
types = {
|
|
ground = {
|
|
behaviours = {
|
|
{ kind = "solid" }
|
|
},
|
|
look = { b = 90, g = 70, h = 40, kind = "box", r = 60, w = 720 }
|
|
},
|
|
hero = {
|
|
behaviours = {
|
|
{ jump = 620, kind = "platformer", speed = 260 }
|
|
},
|
|
look = { anchor = "feet", b = 240, g = 90, h = 44, kind = "box", r = 90, w = 24 }
|
|
},
|
|
readout = {
|
|
look = { b = 245, g = 235, kind = "text", r = 235, text = "score 0" }
|
|
}
|
|
},
|
|
vars = { score = 0 }
|
|
}
|