Fix INT_MAX definition on some newer systems.
[Tsunagari.git] / data / testing / areas / grove01.py
blob9040d2249bf53a0ec6ac3964bcbab7c0e46a7454
1 import areas.sounds
2 #import stdlib.ai.wander
4 ai_wizard = None
5 drinking = False
6 duration = 1.0
7 max_alpha = 192
8 well_timer = None
10 def load():
11 #ai_wizard = stdlib_ai_wander("entities/wizard/wizard.xml", "down", 6, 3, 0.0, 1.0, 4)
13 cloud = Area.new_overlay("entities/cloud/cloud.xml", 11, 2, 10.0, "down")
14 cloud.move(-400, 0)
16 def tick():
17 global drinking, duration, max_alpha
18 if drinking == True:
19 progress = well_timer.count / duration
20 if progress < 0.5:
21 overlay_alpha = int(2 * max_alpha * progress)
22 elif progress < 1.0:
23 overlay_alpha = int(2 * max_alpha * (1 - progress))
24 else:
25 overlay_alpha = 0
26 drinking = False
27 Area.color_overlay(255, 255, 255, overlay_alpha) # white overlay
29 def well():
30 global drinking, well_timer
31 if drinking == False:
32 drinking = True
34 well_timer = new_timer()
35 well_timer.running = True
37 areas.sounds.sound_splash()