an atelier fangame for the pico-8
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.2 KiB

paper_color = 15
highlight_text_color = 0
base_text_color = 5
blank_ingredient_outline_color = 6
light_text_color = 7
ph_p = 72
lenore_portrait = 76
seller_portrait = 136
neighbor_portrait = 140
witch_portrait = 200
librarian_portrait = 204
door_portrait = 196
toast_str=""
toast_timer=0
function toast(text)
toast_str = text
toast_timer = 4
end
function draw_workbench()
-- workbench surface
rectfill(0,0,140,140, 4)
-- seams on the workbench
for i=1,20 do
line(0, i*16, 140, i*16-50, 5)
end
end
function draw_background()
draw_workbench()
-- watch
pal(1,0) -- replace one color with black for the hands
spr(64, -2,0, 4,4)
pal()
-- pen
spr(68, 4, 90, 4,4)
end
function draw_paper(x,y,w,h)
draw_paper_with_color(x,y,w,h,paper_color)
end
function draw_paper_with_color(x,y, w, h, color)
-- paper
rectfill(x,y, x+w,y+h, color)
-- ragged borders
sspr(72,0, 2,8, x-1,y, 2,h+1) -- west
sspr(72,0, 8,2, x,y-1, w+1,2) -- north
sspr(72,0, 2,8, x+w,y, 2,h+1) -- east
sspr(72,0, 8,2, x,y+h, w+1,2) -- south
end
function draw_recipe_on_paper(recipe, x, y)
color(highlight_text_color)
print(recipe.title, x+2, y+2)
-- description
color(base_text_color)
print(library.item_blueprints[recipe.result].description, x+44, y+12)
for i=1,3 do
rect(x+42, y+2+26*i, x+93, y+26*i+24, blank_ingredient_outline_color)
end
-- list of selected active traits
color(highlight_text_color)
print("traits:", x+2, y+78)
end
function decorate_recipe_unfinished(recipe, x, y)
color(blank_ingredient_outline_color)
for i, ing in ipairs(recipe.ingredients) do
print(ing, x+46, y+2+26*i+9)
end
end
function draw_ingredient_listing(ing, x, y)
color(highlight_text_color)
print(ing.title,x+4,y+4)
print_quality(ing.quality, x+54, y+14)
color(base_text_color)
for i, trait in ipairs(ing.traits) do
print(library.traits[trait][1], x+6, 5+y+i*6)
end
end
function print_quality(quality, x, y)
the_str = tostring(quality)
color(highlight_text_color)
print(the_str, x - 5*(#the_str), y)
color()
spr(1, x - 5*(#the_str)-8, y-2)
end