Skip to content

Commit

Permalink
Fix #67
Browse files Browse the repository at this point in the history
- Minor work on jobs
- Added 3 examples of dizziness effects
- Added story auto registrations
- Fixed a bug with forest entrance working of the old maps
  • Loading branch information
XelaPy committed Aug 6, 2015
1 parent c4d79b4 commit 3ca8373
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 19 deletions.
90 changes: 90 additions & 0 deletions game/library/UDDs.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,93 @@ init -999 python:

def predict_files(self):
return self.image.predict_files()


class Mirage(renpy.Displayable):
def __init__(self, displayable, resize=(1280, 720), ycrop=8, amplitude=0, wavelength=0, **kwargs):
super(renpy.Displayable, self).__init__(**kwargs)
displayable = Transform(displayable, size=resize)
self.displayable = list()
for r in xrange(resize[1]/ycrop):
y = r * ycrop
self.displayable.append((Transform(displayable, crop=(0, y, resize[0], ycrop)), y))

# self.image = [Transform(renpy.easy.displayable(image), crop=(0, i+1, width, 2)) for i in range(height/2)]
self.amplitude = amplitude
self.wavelength = wavelength
self.W2 = config.screen_width * 0.5

zoom_factor = 1.0 - self.amplitude
self.x_zoom_factor = 1 / zoom_factor

# Stretch each scanline horizontally, oscillating from +amplitude to -amplitude across specified wavelength
# Shift oscillation over time by st
def render(self, width, height, st, at):
render = renpy.Render(width, height)

h = 1.0
for scanline in self.displayable:
# math.sin(x) returns the sine of x radians
t = Transform(scanline[0], xzoom = self.x_zoom_factor + (math.sin(h / self.wavelength + st) * self.amplitude), yzoom = (1.01))
h += 1.0
child_render = renpy.render(t, 0, 0, st, at)
cW, cH = child_render.get_size()
# final amount subtracted from h sets y placement
render.blit(child_render, ((self.W2) - (cW * 0.5), scanline[1]))
renpy.redraw(self, 0)
return render


init:

transform transpa:

alpha 0.5

python hide:

def gen_randmotion(count, dist, delay):

import random

args = [ ]

for i in range(0, count):
args.append(anim.State(i, None,
Position(xpos=random.randrange(-dist, dist),
ypos=random.randrange(-dist, dist),
xanchor='left',
yanchor='top',
)))

for i in range(0, count):
for j in range(0, count):

if i == j:
continue

args.append(anim.Edge(i, delay, j, MoveTransition(delay)))

return anim.SMAnimation(0, *args)

store.randmotion = gen_randmotion(9, 9, 0.4)


init python:

def double_vision_on(picture):

renpy.scene()

renpy.show(picture)

renpy.show(picture, at_list=[transpa,randmotion], tag="blur_image")

renpy.with_statement(dissolve)


def double_vision_off():

renpy.hide("blur_image")

renpy.with_statement(dissolve)
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ init -9 python:
class BrothelBlock(MainUpgrade):
def __init__(self, name="Brothel", instance=None, desc="Rooms to freck in!", img="content/buildings/upgrades/room.jpg", build_effort=0, materials=None, in_slots=2, cost=500, **kwargs):
super(BrothelBlock, self).__init__(name=name, instance=instance, desc=desc, img=img, build_effort=build_effort, materials=materials, cost=cost, **kwargs)
self.rooms = in_slots
# self.jobs = set(["Whore"])
self.capacity = in_slots
self.jobs = set([simple_jobs["Whore Job"], simple_jobs["Testing Job"]])

def get_clients(self):
Expand All @@ -61,6 +60,9 @@ init -9 python:
super(StripClub, self).__init__(name=name, instance=instance, desc=desc, img=img, build_effort=build_effort, materials=materials, cost=cost, **kwargs)
self.jobs = set(["Stripper"])

self.capacity = in_slots
self.active = set() # On duty Strippers

class Garden(MainUpgrade):
def __init__(self, name="Garden", instance=None, desc="Relax!", img="content/buildings/upgrades/garden.jpg", build_effort=0, materials=None, in_slots=0, ex_slots=2, cost=500, **kwargs):
super(Garden, self).__init__(name=name, instance=instance, desc=desc, img=img, build_effort=build_effort, materials=materials, cost=cost, **kwargs)
Expand Down
34 changes: 33 additions & 1 deletion game/library/examples.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,39 @@ label examples:
# "This was it... sorry for inconvenience..."
# scene black

"First attempt to emulate dizziness:"
show expression Mirage("bg cafe", amplitude=0.04, wavelength=10) as testing
pause
hide testing

"Second Try:"
$ double_vision_on("bg cafe")
pause
$ double_vision_off()

"Third..."
$ temp = im.Scale(ImageReference("bg cafe"), 128, 72)
$ temp = Transform(temp, size=(1280, 720))
show expression temp as bg
with Dissolve(0.4)
show bg cafe
with Dissolve(0.4)
show expression temp as bg
with Dissolve(0.5)
show bg cafe
with Dissolve(0.5)
show expression temp as bg
with Dissolve(0.6)
show bg cafe
with Dissolve(0.4)
show expression temp as bg
with Dissolve(1.0)
show bg cafe
with dissolve

scene black

"Hello... "
# jump intro
extend "I am the narrator! And will be guiding you in this example!"
# Narrator will just display the text. Not from a name of any particular character.

Expand Down Expand Up @@ -176,6 +207,7 @@ label examples_2:
# The game autodefines all background images. We are using that very effectively...
# bg in this case is a prefix tag, cafe is the name of the image that was autodefined. It's a name without extension.
# If we show another bg prefixed image, the current one will be automatically replaced with the new one.

show bg cafe

"Cafe in the center of PyTFall!"
Expand Down
19 changes: 13 additions & 6 deletions game/library/initialization.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -260,29 +260,36 @@ init -999 python:
for fname in os.listdir(gamedir + '/content/gfx/bg'):
if fname.endswith('.jpg') or fname.endswith(".png"):
tag = 'bg ' + fname[:-4]
image = gamedir + '/content/gfx/bg/' + fname
image = 'content/gfx/bg/' + fname
renpy.image(tag, im.Scale(image, config.screen_width,
config.screen_height))

for fname in os.listdir(gamedir + '/content/gfx/bg/locations'):
if fname.endswith('.jpg') or fname.endswith(".png"):
tag = 'bg ' + fname[:-4]
image = gamedir + '/content/gfx/bg/locations/' + fname
image = 'content/gfx/bg/locations/' + fname
renpy.image(tag, im.Scale(image, config.screen_width,
config.screen_height))

for fname in os.listdir(gamedir + '/content/gfx/bg/story'):
if fname.endswith('.jpg') or fname.endswith(".png"):
tag = 'bg ' + "story " + fname[:-4]
image = 'content/gfx/bg/locations/' + fname
renpy.image(tag, im.Scale(image, config.screen_width,
config.screen_height))

for fname in os.listdir(gamedir + '/content/gfx/bg/be'):
if fname.endswith('.jpg'):
tag = 'bg ' + fname[:-4]
image = gamedir + '/content/gfx/bg/be/' + fname
image = 'content/gfx/bg/be/' + fname
renpy.image(tag, im.Scale(image, config.screen_width,
config.screen_height))

# Same thing for sprites and NPC
for fname in os.listdir(gamedir + '/content/gfx/sprites'):
if fname.endswith('.png'):
tag = fname[:-4]
image = gamedir + '/content/gfx/sprites/' + fname
image = 'content/gfx/sprites/' + fname
renpy.image(tag, image)

for fname in os.listdir(gamedir + '/content/gfx/sprites/npc'):
Expand All @@ -292,7 +299,7 @@ init -999 python:
renpy.image(tag, ProportionalScale(image, 400,
600))
tag = 'npc ' + fname[:-4] + '_novel'
image = gamedir + '/content/gfx/sprites/npc/' + fname
image = 'content/gfx/sprites/npc/' + fname
renpy.image(tag, ProportionalScale(image, 600,
700))

Expand All @@ -304,7 +311,7 @@ init -999 python:
renpy.image(tag, ProportionalScale(image, 400,
600))
tag = 'npc ' + fname[:-4] + '_novel'
image = gamedir + '/content/gfx/sprites/npc/' + fname
image = 'content/gfx/sprites/npc/' + fname
renpy.image(tag, ProportionalScale(image, 600,
700))

Expand Down
23 changes: 14 additions & 9 deletions game/library/screens/locations/pyt - screens - forest entrance.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ label forest_entrance:

python:

while True:
while 1:
result = ui.interact()
if result[0] == 'jump':
gm.start_gm(result[1])
Expand Down Expand Up @@ -77,11 +77,16 @@ screen pyt_forest_entrance:

use rg_lightbutton(img=entry.show(*entry.flag("forest_entrance_tags")[1], exclude=["urban", "wildness", "suburb", "winter", "swimsuit"], type="first_default",label_cache=True, resize=(300, 400)), return_value=['jump', entry])

for key in pytfall.maps['ForestEntrance']:
python:
map_point = pytfall.maps['ForestEntrance'][key]['attr']
x = int(map_point['x']) / float(config.screen_width)
y = int(map_point['y']) / float(config.screen_height)
use r_lightbutton(img=im.Scale(map_point['image'], 20, 20), return_value=['location',key], align=(x,y))
frame background Solid((0,0,0,128)) align (x,y+0.05):
text (u"{size=-4}%s"%(map_point['name']))
for key in pytfall.maps("pytfall_fe"):
if not key.get("hidden", False):
if "img" in key:
python:
rx = int(key["rx"]) if "rx" in key else 25
ry = int(key["ry"]) if "ry" in key else 25
x = int(key['x']) / float(config.screen_width)
y = int(key['y']) / float(config.screen_height)
use r_lightbutton(img=ProportionalScale(key['img'], rx, ry), return_value=['location', key["id"]], align=(x, y))
frame:
background Frame(Transform(im.Twocolor("content/gfx/frame/ink_box.png", white, grey), alpha=0.5), 5, 5)
align (x, y+0.05)
text (u"%s"%(key['name'])) size 16 color black
5 changes: 4 additions & 1 deletion game/library/temp_logic.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ init python:
This should be a job...
"""
yield self.env.timeout(self.job_time)
if config.debug:
temp = "Debug: {} Resource (rooms) currently occupied!".format(set_font_color(self.room.count, "red"))
store.building.nd_events_report.append(temp)

temp = "{} and {} did their thing!".format(set_font_color(char.name, "pink"), client.name)
store.building.nd_events_report.append(temp)
Expand Down Expand Up @@ -129,7 +132,7 @@ init python:
label temp_jobs_loop:
# Setup and start the simulation
$ store.building.nd_events_report.append("\n\n")
$ store.building.nd_events_report.append("{}".format(set_font_color("===================", "lawngreen")))
$ store.building.nd_events_report.append(set_font_color("===================", "lawngreen"))
$ store.building.nd_events_report.append("{}".format(set_font_color("Starting the simulation:", "lawngreen")))
$ store.building.nd_events_report.append("{}".format(set_font_color("Testing a Brothel with two rooms:", "lawngreen")))
# $ random.seed(RANDOM_SEED) # This helps reproducing the results
Expand Down

0 comments on commit 3ca8373

Please sign in to comment.