32 lines
1.1 KiB
Text
32 lines
1.1 KiB
Text
-- A game with a vocabulary of its own: the bob behaviour, the bobbing condition, and the setBob
|
|
-- action live in vocab.singe beside this file, not in Forge.
|
|
return {
|
|
title = "Author test: a game's own vocabulary",
|
|
players = 1,
|
|
size = { w = 720, h = 480 },
|
|
layers = { { kind = "overlay" } },
|
|
vocabulary = "vocab.singe",
|
|
vars = { seen = 0 },
|
|
|
|
types = {
|
|
buoy = { look = { kind = "box", w = 30, h = 30, r = 80, g = 200, b = 255 }, behaviours = { { kind = "bob", height = 40, speed = 3 } } },
|
|
rock = { look = { kind = "box", w = 30, h = 30, r = 120, g = 120, b = 120 } }
|
|
},
|
|
|
|
rooms = {
|
|
{ name = "sea",
|
|
entities = {
|
|
{ type = "buoy", id = "buoy", x = 200, y = 240 },
|
|
{ type = "rock", id = "rock", x = 500, y = 240 }
|
|
} }
|
|
},
|
|
|
|
rules = {
|
|
{ note = "Counts the frames the buoy bobs",
|
|
on = "frame", when = { { "bobbing", entity = "buoy" } },
|
|
act = { { "setVar", name = "seen", value = "seen + 1" } } },
|
|
{ note = "SPACE makes it bob higher",
|
|
on = "pressed", key = "SPACE",
|
|
act = { { "setBob", entity = "buoy", height = 100 } } }
|
|
}
|
|
}
|