~ubuntu-branches/ubuntu/utopic/frogatto-data/utopic

« back to all changes in this revision

Viewing changes to data/objects/milgramen/kitty_sword.cfg

  • Committer: Bazaar Package Importer
  • Author(s): Dmitry E. Oboukhov
  • Date: 2010-07-16 12:14:11 UTC
  • Revision ID: james.westby@ubuntu.com-20100716121411-tobhfbyxrrz46dwz
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
[object_type]
 
2
always_active=yes
 
3
friction="1000"
 
4
functions="#looks for the player and turns to face it#  
 
5
          def set_facing(obj,level) if(desired_facing != obj.facing, [animation('turn'),set(obj.facing, desired_facing)], animation('walk')
 
6
                   ) where desired_facing = if(level.player.x < obj.x, -1, 1);
 
7
 
 
8
 
 
9
          #if the player is in an opportune spot, attack it#    
 
10
          def consider_attacking(obj,level) if((desired_facing = obj.facing) and (abs(level.player.x - obj.x) < 150) and (abs(level.player.y - obj.y) < 50), animation('prepare_jump'), animation('walk')
 
11
                   ) where desired_facing = if(level.player.x < obj.x, -1, 1);
 
12
        1"
 
13
hitpoints="20"
 
14
id="kitty_sword"
 
15
mass="64"
 
16
on_create="set(level.gui.vars.bosses, level.gui.vars.bosses + [me])"
 
17
on_bounced_on="if(is_invincible_posthit,null(),[add(hitpoints, -2),set(tmp.time_last_hit, cycle), set(me.green, 0), set(me.blue, 0), schedule(4, [set(me.green, 255), set(me.blue, 255)]), if(jumped_on_by.mass >= 1000, die(), animation('spring'))])"
 
18
on_collide="
 
19
 if(collide_with = level.player,
 
20
   #make it so if we collide with the player we immediately jump/attack.
 
21
    this ensures the kitty can't simply get stuck between the player and a wall#
 
22
   animation('jump'),
 
23
  [
 
24
  if(animation = 'lunge_attack' and (not collide_with),
 
25
                    [animation('lunge_stuck'), add(x,-50*facing),set(velocity_x,0), set(tmp.stuck_count, 0)]),
 
26
  if(not (animation in ['jump_attack', 'lunge_attack', 'lunge_stuck', 'lunge_unstuck']), [set(facing, -facing), animation('turn'), set(velocity_x, 0)])
 
27
                 ])"
 
28
on_die="[score(level,points_value), spawn_item(self), spawn('die_cloud', midpoint_x, midpoint_y, facing)]"
 
29
on_end_hurt_anim="animation('stand')"
 
30
on_end_jump_attack_anim="[animation('walk'), set(tmp.can_attack_at, cycle+50)]"
 
31
on_end_lunge_anim="animation('walk')"
 
32
on_end_lunge_attack_anim="[animation('walk')]"
 
33
on_end_prepare_lunge_anim="if(cycle - vars.began_charging > consts.charge_duration,animation('lunge'),animation('prepare_lunge'))"
 
34
on_end_prepare_jump_anim="if(cycle - vars.began_charging > consts.charge_duration,fire_event('initiate_jump'),animation('prepare_jump'))"
 
35
 
 
36
 
 
37
on_end_lunge_stuck_anim="if(tmp.stuck_count > 4, animation('lunge_unstuck'), [animation('lunge_stuck'), set(tmp.stuck_count, tmp.stuck_count+1)])"
 
38
on_end_lunge_unstuck_anim="animation('stand')"
 
39
on_end_spring_anim="animation('stand')"
 
40
on_end_stand_anim="if(is_standing, animation('walk'), animation('stand'))"
 
41
on_end_turn_anim="animation('walk')"
 
42
on_end_walk_anim="if((not facing_player),
 
43
  if(abs(level.player.midpoint_x - midpoint_x) < 800, set(facing, -facing)),
 
44
 
 
45
  if(cycle > tmp.can_attack_at and abs(level.player.midpoint_x - midpoint_x) < (300 + 1d200),
 
46
 
 
47
   if((1d4 = 1) or (abs(level.player.y - y) > 50),
 
48
    [animation('prepare_jump'),set(vars.began_charging,cycle)],
 
49
        [animation('prepare_lunge'),set(vars.began_charging,cycle)]
 
50
        ),
 
51
 
 
52
if(distance_to_cliff < 80, [set(facing, -facing), animation('turn')], animation('walk'))))"
 
53
 
 
54
 
 
55
on_initiate_jump="[animation('jump'), if(level.player.x > midpoint_x,facing(1),facing(-1)),set(velocity_x, (level.player.midpoint_x - midpoint_x)*4), if(level.player.y > y2 and is_standing_on_platform, [set(fall_through_platforms, 20), set(velocity_y, 0)], if(midpoint_y - level.player.midpoint_y > 200, [set(velocity_y, -2200)]))]"
 
56
 
 
57
on_enter_anim="set(tmp.already_hit, [])"
 
58
on_enter_water="die()"
 
59
on_process_jump="if(abs(level.player.midpoint_x - midpoint_x) < 80 and level.player.y2 > y,
 
60
                       [animation('jump_attack')],
 
61
                                                if(is_standing, animation('stand')))"
 
62
on_process_lunge="if(abs(level.player.midpoint_x - midpoint_x) < 200,
 
63
                     animation('lunge_attack'))"
 
64
                     
 
65
                     
 
66
timer_frequency=2
 
67
on_timer="              if(is_invincible_posthit, set(alpha,(wave(cycle*300)+1000)/10 + 100), set(alpha,255))"
 
68
                     
 
69
prototype="hittable"
 
70
solid_area="13,9,33,34"
 
71
solid_dimensions="common"
 
72
traction="1000"
 
73
traction_in_air="200"
 
74
        [editor_info]
 
75
        category="milgramen"
 
76
        [/editor_info]
 
77
 
 
78
        [properties]
 
79
        facing_player="if(level.player.x < x, facing < 0, facing > 0)"
 
80
        hurt_velocity_x="0"
 
81
        hurt_velocity_y="0"
 
82
        [/properties]
 
83
 
 
84
        [vars]
 
85
        damage="1"
 
86
        points_value="50"
 
87
        team="'evil'"
 
88
        turns_at_cliffs="1"
 
89
        turns_towards_player="1"
 
90
        began_charging="0"
 
91
        [/vars]
 
92
 
 
93
        [consts]
 
94
        flinch_threshold="2"
 
95
        posthit_invicibility_period=150
 
96
        springiness="200"
 
97
        charge_duration=80
 
98
        spring_amount=1400
 
99
        bounce_roundness=200
 
100
        [/consts]
 
101
 
 
102
        [tmp]
 
103
        can_attack_at="-1"
 
104
        [/tmp]
 
105
 
 
106
        [base:animation]
 
107
        image="enemies/kitty-sword.png"
 
108
        pad="3"
 
109
        body_area="all"
 
110
        accel_x="0"
 
111
        accel_y="80"
 
112
        [/animation]
 
113
        
 
114
 
 
115
        [animation]
 
116
        id="stand"
 
117
        duration="18"
 
118
        frames="1"
 
119
        rect="1,1,41,36"
 
120
        [/animation]
 
121
 
 
122
        [animation]
 
123
        id="turn"
 
124
        duration="2"
 
125
        frames="1"
 
126
        frames_per_row="1"
 
127
        rect="1,1,41,36"
 
128
        [/animation]
 
129
 
 
130
        [animation]
 
131
        id="walk"
 
132
        accel_x="360"
 
133
        duplicates="6"
 
134
        duration="6"
 
135
        frames="3"
 
136
        rect="1,1,41,36"
 
137
        [/animation]
 
138
 
 
139
        #blink variation of walking
 
140
        [animation]
 
141
        id="walk"
 
142
        accel_x="300"
 
143
        duration="6"
 
144
        frames="3"
 
145
        frames_per_row="3"
 
146
        rect="133,1,173,36"
 
147
        [/animation]
 
148
 
 
149
        [animation]
 
150
        id="spring"
 
151
        duration="2"
 
152
        frames="5"
 
153
        frames_per_row="5"
 
154
        rect="1,40,51,75"
 
155
        reverse="yes"
 
156
        [/animation]
 
157
 
 
158
        [animation]
 
159
        id="hurt"
 
160
        duration="18"
 
161
        events="6:12:18:hurtflicker"
 
162
        frames="1"
 
163
        rect="1,1,41,36"
 
164
        [/animation]
 
165
 
 
166
        [animation]
 
167
        id="prepare_lunge"
 
168
        duration="2"
 
169
        frames="3"
 
170
        frames_per_row="3"
 
171
        rect="1,79,41,114"
 
172
        [/animation]
 
173
 
 
174
        [animation]
 
175
        id="lunge"
 
176
        accel_x="2800"
 
177
        duration="10"
 
178
        frames="3"
 
179
        rect="133,79,173,114"
 
180
        [/animation]
 
181
 
 
182
        [animation]
 
183
        id="lunge"
 
184
        accel_x="2800"
 
185
        attack_area="12,0,40,34"
 
186
        duration="6"
 
187
        frames="3"
 
188
        frames_per_row="3"
 
189
        id="lunge_attack"
 
190
        rect="1,118,55,153"
 
191
        [/animation]
 
192
 
 
193
        [animation]
 
194
        id="lunge_stuck"
 
195
        accel_x="0"
 
196
        duration="5"
 
197
        frames="3"
 
198
        frames_per_row="3"
 
199
        solid_area="10,10,30,35"
 
200
        rect="1,157,55,192"
 
201
        rows="2"
 
202
        [/animation]
 
203
 
 
204
        [animation]
 
205
        id="jump"
 
206
        duration="10"
 
207
        frames="3"
 
208
        frames_per_row="3"
 
209
        rect="1,198,41,251"
 
210
        solid_area="13,29,33,54"
 
211
        velocity_y="-1600"
 
212
        [/animation]
 
213
 
 
214
        [animation]
 
215
        id="prepare_jump"
 
216
        duration="2"
 
217
        frames="2"
 
218
        frames_per_row="2"
 
219
        rect="207,242,247,290"
 
220
        [/animation]
 
221
 
 
222
        [animation]
 
223
        id="jump_attack"
 
224
        accel_x="-80"
 
225
        accel_y="120"
 
226
        attack_area="12,0,40,34"
 
227
        duration="10"
 
228
        frames="3"
 
229
        frames_per_row="3"
 
230
        rect="1,255,60,290"
 
231
        [/animation]
 
232
 
 
233
        [animation]
 
234
        id="lunge_unstuck"
 
235
        duration="10"
 
236
        frames="1"
 
237
        frames_per_row="1"
 
238
        solid_area="10,10,30,35"
 
239
        rect="181,157,235,192"
 
240
        [/animation]
 
241
 
 
242
[/object_type]
 
243