Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- black = color(0, 0, 0, 255)
- red = color(255, 0, 0, 255)
- blue = color(2, 0, 255, 255)
- yellow = color(251, 255, 0, 255)
- green = color(2, 255, 0, 255)
- white = color(255, 255, 255, 255)
- purple = color(255, 0, 252, 255)
- cyan = color(0,255,255,255)
- grey = color(127, 127, 127, 255)
- brown = color(111, 87, 31, 255)
- octarine = color(71, 31, 106, 255)
- L = true
- R = false
- function setup()
- parameter("Scale", 1, 15, 1)
- parameter("Speed", 0, 4, 2)
- offset = vec2(WIDTH/2, HEIGHT/2)
- board = image(WIDTH, HEIGHT, red)
- fred = Ant(vec2(0,1), offset.x, offset.y, {R,L,R,L, R,L, L,R,L,R})
- jeff = Ant(vec2(1,0), 0, 0, {R,L})
- colors={black,red,blue,yellow,green,white,purple,cyan,brown,octarine}
- end
- function draw()
- background(40, 40, 50)
- spriteMode(CENTER)
- scale(Scale)
- sprite(board, offset.x/Scale, offset.y/Scale)
- spd = math.floor(10^Speed)
- for i = 1,spd do
- fred:go(board)
- jeff:go(board)
- end
- end
- function touched(t)
- offset.x = offset.x + t.deltaX
- offset.y = offset.y + t.deltaY
- if t.tapCount == 2 then
- offset.x = WIDTH/2
- offset.y = HEIGHT/2
- end
- end
- function colorEqual(x,y)
- if x.r==y.r and x.g==y.g and x.b==y.b then
- return true
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement