This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This file is loaded before any user scripts, removing unsafe environment functions | |
------------------------------------------------ | |
-- Block out any dangerous or insecure functions | |
------------------------------------------------ | |
arg=nil | |
__loadedProjects = {} | |
import = function(projectName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Levels.lua | |
-- Level are organized in packs, each pack consists of 6 levels. | |
-- - Level definitions include; | |
-- - name: shows in the level chooser screen as well at at the top of the level. Also used to | |
-- save solutions and score | |
-- - claw: the starting position of the claw (the pile number where it starts) | |
-- - stars: an array of two elems. The first is the max number of instructions allowed for 2 | |
-- starts and the second, the max number of instructions allowed for 3 stars | |
-- - funcs: specifies the number of progs and the lenght of progs allowed in that level |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Actor = class() | |
function Actor:init(pos,side,color,backgroundC,lev) | |
self.pos = pos*side*8+vec2(side*4,0) -- actors start in between squares | |
self.targetPos = pos -- the square where we're going | |
self.side = side -- misnamed. this is the num of ipad pixels per pacman pixel | |
self.dir = vec2(0,0) -- once we get to targetPos, which direction to go | |
self.color = color | |
self.backgroundC = backgroundC | |
self.level = lev -- point back to the parent level |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function draw() | |
background() | |
if not currentScreen then currentScreen = StartScreen() end | |
currentScreen:draw() | |
end | |
function touched(t) | |
if currentScreen and currentScreen.touched then currentScreen:touched(t) end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() | |
noSmooth() | |
atlas = Atlas() | |
-- map a few test functions | |
atlas:map("test1",draw1,200,100) | |
atlas:map("test2",draw2,200,100) | |
atlas:map("test3",draw3,101,171) | |
atlas:map("test4",draw4,WIDTH-10,100) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tileSize = 40 | |
wallThickness = 15 | |
gridW = 15 | |
gridH = 11 | |
dims = vec2(tileSize*gridW,tileSize*gridH) | |
bottom = vec2(60,60) | |
top = bottom+dims | |
ballRadius = tileSize/4 | |
speedY = 4.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ ------------------------------------------------------------ | |
Main.lua | |
--]] ------------------------------------------------------------ | |
-- global screen size constants | |
bottomY = HEIGHT *.21 | |
trackWidth = WIDTH * .9 -- width of the track at the bottom | |
horizonY = trackWidth * .55 + bottomY | |
trackHeight = horizonY - bottomY | |
trackLength = 100 -- in meters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backgroundC = color(0, 0, 0, 255) | |
time = 0 | |
won = false | |
-- open is the angle of the openning. top is where the hole is (top or bottom) | |
circles = { | |
{ radius = 75, top = true }, | |
{ radius = 150, top = false }, | |
{ radius = 225, top = true }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backgroundC = color(0, 0, 0, 255) | |
time = 0 | |
won = false | |
-- open is the angle of the openning. top is where the hole is (top or bottom) | |
circles = { | |
{ radius = 75, top = true }, | |
{ radius = 150, top = false }, | |
{ radius = 225, top = true }, | |
--{ radius = 300, top = false }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backgroundC = color(0, 0, 0, 255) | |
-- top is where the hole is (top or bottom) circles = { { radius = 75, top = true }, { radius = 150, top = false }, { radius = 225, top = true }, { radius = 300, top = false }, } | |
balls = { { x = 300, y = 300, speedX = 0, speedY = 0, radius = 10 }, { x = -300, y = -300, speedX = 0, speedY = 0, radius = 10 }, { x = -300, y = 300, speedX = 0, speedY = 0, radius = 10 }, { x = 300, y = -300, speedX = 0, speedY = 0, radius = 10 } } | |
-- This function gets called once every frame function draw() ellipseMode(RADIUS) pushMatrix() translate(WIDTH/2, HEIGHT/2) background(backgroundC) | |
drawWalls() |