-
Notifications
You must be signed in to change notification settings - Fork 0
/
plants_animations.py
101 lines (59 loc) · 4.44 KB
/
plants_animations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
'''Запускает анимацию на текущем экземпляре объекта со случайной скоростью.
На нужном объекте добавляем сенсор Delay с контроллером Python, тип - модуль.
Далее запускаем нужную функцию.
Author: Vladislav Naumov. [email protected]; github.com/vlad1777d; vk.com/naumovvladislav
License: CC-BY. To use this under other license contact author.
Revision: 4
'''
import bge
import random
def get_random_multipling_number():
multipling_number = random.choice((0.8, 0.9, 1.0, 1.1, 1.2, 1.3))
return multipling_number
def get_object():
number = random.choice((-0.3, -0.2, -0.1, 0.0, 0.1, 0.2))
contr = bge.logic.getCurrentController()
obj = contr.owner
return number, obj
def grass_main_armature():
number, obj = get_object()
obj.playAction('grass_main_wind', 1, 120, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=0.3 * get_random_multipling_number(), blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def grass_violent():
number, obj = get_object()
obj.playAction('grass_violent_wind', 1, 122, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_PING_PONG, layer_weight=0.0, ipo_flags=0, speed=1.8 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def grass_liana():
number, obj = get_object()
obj.playAction('grass_liana_wind', 1, 146, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_PING_PONG, layer_weight=0.0, ipo_flags=0, speed=1.5 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def grass_dry():
number, obj = get_object()
obj.playAction('grass_dry_wind', 1, 160, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_PING_PONG, layer_weight=0.0, ipo_flags=0, speed=1.5 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def grass_1_armature():
number, obj = get_object()
obj.playAction('grass_1_wind', 1, 159, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def grass_2_armature():
number, obj = get_object()
obj.playAction('grass_2_wind', 1, 121, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def grass_3_4_armature():
number, obj = get_object()
obj.playAction('grass_3_4_wind', 1, 121, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def grass_4_armature():
number, obj = get_object()
obj.playAction('grass_4_wind', 1, 121, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def grass_6_armature():
number, obj = get_object()
obj.playAction('grass_4_wind', 1, 181, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def tree_3_armature():
number, obj = get_object()
obj.playAction('tree_3_wind', 1, 601, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def tree_3_LOD1_armature():
number, obj = get_object()
obj.playAction('tree_3_LOD1_wind', 1, 301, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def tree_4_armature():
number, obj = get_object()
obj.playAction('tree_4_wind', 1, 601, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def tree_4_LOD1_armature():
number, obj = get_object()
obj.playAction('tree_4_LOD1_wind', 1, 451, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)
def tree_5_armature():
number, obj = get_object()
obj.playAction('tree_5_wind', 1, 301, layer=0, priority=1, blendin=0, play_mode=bge.logic.KX_ACTION_MODE_LOOP, layer_weight=0.0, ipo_flags=0, speed=1 + number, blend_mode=bge.logic.KX_ACTION_BLEND_BLEND)