-- Written by Forge/AuthorCompile.singe. Edit by hand or in the editor; either is fine. return { types = { hive = { behaviours = { { every = 0.6, kind = "spawner", max = 6, spawns = "rock", total = 12 } }, look = { kind = "none" }, vars = {} }, readout = { look = { b = 245, g = 235, kind = "text", r = 235, text = "score 0" } }, rock = { behaviours = { { kind = "drift", vy = 90 }, { kind = "health", max = 2 }, { death = "Forge/kit/hit.wav", kind = "sound" } }, look = { file = "Forge/kit/rock.png", kind = "sprite" }, vars = { health = 2 } }, ship = { behaviours = { { down = "DOWN", fire = "SPACE", kind = "keys", left = "LEFT", right = "RIGHT", up = "UP" }, { clamp = true, kind = "mover", speed = 260 }, { kind = "shooter", offsetY = -14, rate = 0.15, spawns = "shot" }, { keep = true, kind = "health", max = 1 }, { hit = "Forge/kit/hit.wav", kind = "sound" } }, look = { file = "Forge/kit/ship.png", kind = "sprite" }, vars = { health = 1 } }, shot = { behaviours = { { kind = "projectile", life = 3, vy = -520 }, { kind = "sound", spawn = "Forge/kit/shot.wav" } }, look = { file = "Forge/kit/shot.png", kind = "sprite" }, vars = {} } }, layers = { { kind = "overlay" } }, rooms = { { entities = { { id = "readout", type = "readout", x = 12, y = 12 }, { id = "ship", type = "ship", x = 360, y = 420 }, { id = "hive", type = "hive", x = 360, y = 20 }, { id = "hive1", type = "hive", x = 560, y = 20 } }, name = "start", tracks = {} } }, rules = { { act = { { "setText", entity = "readout", text = "\"score \" .. score .. \" lives \" .. lives" } }, note = "The readout, every frame", on = "frame" }, { a = "shot", act = { { "destroy", entity = "self" }, { "damage", amount = 1, entity = "other" }, { "addScore", amount = 10 } }, b = "rock", note = "A shot lands on a rock", on = "collision", when = {} }, { act = { { "emit", b = 60, count = 24, entity = "self", g = 120, r = 255 }, { "addScore", amount = 50 } }, type = "rock", note = "A rock dies", on = "death", when = {} }, { a = "rock", act = { { "destroy", entity = "self" }, { "damage", amount = 1, entity = "other" } }, b = "ship", note = "A rock rams the ship", on = "collision", when = {} }, { act = { { "addVar", amount = -1, name = "lives" }, { "flash", b = 60, g = 60, r = 255, seconds = 0.3 }, { "setVar", entity = "self", name = "health", value = "1" }, { "moveTo", entity = "self", x = 360, y = 420 } }, type = "ship", note = "The ship is lost", on = "death", when = {} }, { act = { { "gameOver" } }, note = "Out of lives", on = "frame", when = { { "test", expr = "lives <= 0" } } }, { act = { { "destroy", entity = "self" } }, each = "rock", note = "A rock slips past the bottom", on = "frame", when = { { "test", expr = "self.y > 500" } } } }, title = "Rocks", vars = { lives = 3, score = 0 } }