144 lines
3.1 KiB
Text
144 lines
3.1 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 },
|
|
{ id = "coin", type = "coin", x = 300, y = 392 },
|
|
{ id = "coin1", type = "coin", x = 420, y = 392 },
|
|
{ id = "coin2", type = "coin", x = 560, y = 300 },
|
|
{ id = "spike", type = "spike", x = 640, y = 420 },
|
|
{ id = "door", type = "door", x = 700, y = 420 }
|
|
},
|
|
name = "start",
|
|
tracks = {}
|
|
},
|
|
{
|
|
entities = {
|
|
{ id = "ground", type = "ground", x = 360, y = 440 },
|
|
{ id = "readout", type = "readout", x = 12, y = 12 },
|
|
{ id = "coin", type = "coin", x = 400, y = 392 }
|
|
},
|
|
name = "cave",
|
|
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"
|
|
},
|
|
{
|
|
a = "coin",
|
|
act = {
|
|
{ "addScore", amount = 10 },
|
|
{ "destroy", entity = "self" },
|
|
{ "playSound", file = "Forge/kit/coin.wav" }
|
|
},
|
|
b = "hero",
|
|
note = "Take a coin",
|
|
on = "enter",
|
|
when = {}
|
|
},
|
|
{
|
|
a = "spike",
|
|
act = {
|
|
{ "moveTo", entity = "hero", x = 200, y = 380 },
|
|
{ "playSound", file = "Forge/kit/hit.wav" }
|
|
},
|
|
b = "hero",
|
|
note = "Spikes hurt",
|
|
on = "enter",
|
|
when = {}
|
|
},
|
|
{
|
|
a = "door",
|
|
act = {
|
|
{ "goTo", entity = "hero", room = "cave", x = 60, y = 380 }
|
|
},
|
|
b = "hero",
|
|
note = "Through the door",
|
|
on = "enter",
|
|
when = {}
|
|
}
|
|
},
|
|
title = "New game",
|
|
types = {
|
|
coin = {
|
|
behaviours = {
|
|
{ kind = "trigger" }
|
|
},
|
|
look = { file = "Forge/kit/coin.png", kind = "sprite" },
|
|
vars = {}
|
|
},
|
|
door = {
|
|
behaviours = {
|
|
{ kind = "trigger" }
|
|
},
|
|
look = { anchor = "feet", file = "Forge/kit/door.png", kind = "sprite" },
|
|
vars = {}
|
|
},
|
|
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" }
|
|
},
|
|
spike = {
|
|
behaviours = {
|
|
{ kind = "trigger" }
|
|
},
|
|
look = { anchor = "feet", file = "Forge/kit/spike.png", kind = "sprite" },
|
|
vars = {}
|
|
}
|
|
},
|
|
vars = { score = 0 }
|
|
}
|