Skip to content

Instantly share code, notes, and snippets.

@averymd
Created March 29, 2019 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save averymd/f91b6ac3c309d23df8fccb97f01dc169 to your computer and use it in GitHub Desktop.
Save averymd/f91b6ac3c309d23df8fccb97f01dc169 to your computer and use it in GitHub Desktop.
Ace Systems Go! Photo Generation
init 1 python:
def generate_family_photo():
comp = {}
# first, the frame
comp['frame'] = {
'filename': 'images/fam-photo/frames/' + 'frame-{:0>3d}.png'.format(renpy.random.randint(1,3)),
'x': 0,
'y': 0
}
family = []
peep_order = renpy.random.sample(xrange(5), 5)
x_spots = [150, 320, 50, 240, 420]
y_spots = [100, 100, 200, 200, 200]
for idx, fam_member in enumerate(peep_order):
family.append({
'filename': 'images/fam-photo/characters/' + '{:0>2d}.png'.format(fam_member + 1),
'x': x_spots[idx],
'y': y_spots[idx],
'xsize': 250,
'ysize': 250
})
comp['family'] = family
cutesies = []
small_width = 125
small_height = 150
large_width = 700
large_height = 50
num_stickers = renpy.random.randint(1, 2)
for y in range(1, num_stickers):
sticker = renpy.random.randint(1,27)
cutesies.append({
'filename': 'images/fam-photo/cutesies/' + 'cute-{:0>2d}.png'.format(sticker),
'x': 20 + renpy.random.randint(10, small_width),
'y': 30 + renpy.random.randint(10, small_height)
})
num_stickers = renpy.random.randint(1, 2)
for y in range(1, num_stickers):
sticker = renpy.random.randint(1,27)
cutesies.append({
'filename': 'images/fam-photo/cutesies/' + 'cute-{:0>2d}.png'.format(sticker),
'x': 500 + renpy.random.randint(10, small_width),
'y': 30 + renpy.random.randint(10, small_height)
})
# A strip across the top? SURE!
num_stickers = renpy.random.randint(2, 4)
for y in range(1, num_stickers):
sticker = renpy.random.randint(1,27)
cutesies.append({
'filename': 'images/fam-photo/cutesies/' + 'cute-{:0>2d}.png'.format(sticker),
'x': 30 + renpy.random.randint(10, large_width),
'y': 30 + renpy.random.randint(10, large_height),
})
# NEEEEEEDS. Just do this deterministically
# One in each corner.
if libido < libido_target - 1:
cutesies.append({
'filename': 'images/fam-photo/needs/libido-low.png',
'x': 50 + renpy.random.randint(10, 100),
'y': 50 + renpy.random.randint(10, 100)
})
else:
cutesies.append({
'filename': 'images/fam-photo/needs/libido-high.png',
'x': 50 + renpy.random.randint(0, 100),
'y': 50 + renpy.random.randint(0, 100),
})
if comfort < comfort_target - 1:
cutesies.append({
'filename': 'images/fam-photo/needs/comfort-low.png',
'x': 50 + renpy.random.randint(10, 100),
'y': 350 + renpy.random.randint(10, 100),
})
else:
cutesies.append({
'filename': 'images/fam-photo/needs/comfort-high.png',
'x': 50 + renpy.random.randint(10, 100),
'y': 350 + renpy.random.randint(10, 100),
})
if fun < fun_target - 1:
cutesies.append({
'filename': 'images/fam-photo/needs/fun-low.png',
'x': 550 + renpy.random.randint(10, 100),
'y': 50 + renpy.random.randint(10, 100),
})
else:
cutesies.append({
'filename': 'images/fam-photo/needs/fun-high.png',
'x': 550 + renpy.random.randint(10, 100),
'y': 50 + renpy.random.randint(10, 100),
})
if kink < kink_target - 1:
cutesies.append({
'filename': 'images/fam-photo/needs/kink-low.png',
'x': 550 + renpy.random.randint(10, 100),
'y': 300 + renpy.random.randint(10, 100),
})
else:
cutesies.append({
'filename': 'images/fam-photo/needs/kink-high.png',
'x': 550 + renpy.random.randint(10, 100),
'y': 300 + renpy.random.randint(10, 100),
})
print 'final cutes: ' + str(cutesies)
comp['cutesies'] = cutesies
return comp
screen fam_photo:
style_prefix 'photo'
modal False
frame:
xpadding 10
ypadding 10
background None
text 'Snap a photo of your family before you go!'
use comp_photo(photos)
textbutton '[[ Hmm. Not quite. ]' text_style "photogen_buttons" xalign 0.3 ypos 625 action Jump('family_photo')
textbutton "[[ Perfect! Let's go! ]" text_style "photogen_buttons" xalign 0.7 ypos 625 action Jump('mission_closing')
screen comp_photo(photos):
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.25
background None
xysize 700,400
$ framewidth = 700
# show outer frame
add photos['frame']['filename'] maxsize framewidth,framewidth
for photo in photos['family']:
add photo['filename'] xpos photo['x'] ypos photo['y'] maxsize photo['xsize'], photo['ysize']
for photo in photos['cutesies']:
add photo['filename'] xpos photo['x'] ypos photo['y'] anchor 0.5, 0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment