vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- event ball bewegt sich |
2 | function wowon_event_ball (b) |
||
3 | -- b = ballnummer |
||
4 | |||
5 | -- berechnungsstufe |
||
6 | local b_lvl = nil |
||
7 | -- angaben für verfeinerung der berechnung |
||
8 | if (wowon.game.ball[b].a>3) then |
||
9 | -- aufgerundet |
||
10 | b_lvl = math.ceil(wowon.game.ball[b].a/1.2) |
||
11 | else |
||
12 | b_lvl = 1 |
||
13 | end |
||
14 | |||
15 | -- schlaufe für berechnungsstufe |
||
16 | for i = 1, b_lvl do |
||
17 | |||
18 | -- neue position des balles berechnen und anzeigen |
||
19 | wowon_sf_ball_move (b, b_lvl) |
||
20 | |||
21 | --wowon_debug (b) |
||
22 | |||
23 | -- h = höhe des sf |
||
24 | local hf = wowon.game.feld.y |
||
25 | -- b = breite des sf |
||
26 | local bf = wowon.game.feld.x |
||
27 | -- r = ballradius |
||
28 | local r = wowon.game.ball[b].r |
||
29 | |||
30 | -- spielfeld aussentest |
||
31 | local p, w = wowon_geo_ball_out (b) |
||
32 | -- vorhin berechnete position |
||
33 | local pos = wowon.game.ball[b].pos_temp |
||
34 | -- ball ist drausen |
||
35 | if not (p == nil) then |
||
36 | -- ball oben |
||
37 | if (p == 1 ) and not (pos == 1) then |
||
38 | wowon.game.ball[b].y = hf-r |
||
39 | wowon.game.ball[b].pos_temp = 1 |
||
40 | wowon.game.ball[b].posfeld_temp = nil |
||
41 | -- winkel ändern |
||
42 | wowon_geo_winkel (b, p, w) |
||
43 | -- ball links |
||
44 | elseif (p == 7) and not (pos == 7) then |
||
45 | wowon.game.ball[b].x = r |
||
46 | wowon.game.ball[b].pos_temp = 7 |
||
47 | wowon.game.ball[b].posfeld_temp = nil |
||
48 | -- winkel ändern |
||
49 | wowon_geo_winkel (b, p, w) |
||
50 | -- ball rechts |
||
51 | elseif (p == 3) and not (pos == 3) then |
||
52 | wowon.game.ball[b].x = bf-r |
||
53 | wowon.game.ball[b].pos_temp = 3 |
||
54 | wowon.game.ball[b].posfeld_temp = nil |
||
55 | -- winkel ändern |
||
56 | wowon_geo_winkel (b, p, w) |
||
57 | -- ball beim balken |
||
58 | elseif (p == "b") and not (pos == "b") then |
||
59 | wowon.game.ball[b].y = wowon.game.feld.o+r |
||
60 | wowon.game.ball[b].pos_temp = "b" |
||
61 | wowon.game.ball[b].posfeld_temp = nil |
||
62 | wowon_event_ballbalken (b) |
||
63 | return |
||
64 | elseif (p == 5) then |
||
65 | wowon_event_ball_out (b) |
||
66 | return |
||
67 | else |
||
68 | return |
||
69 | end |
||
70 | -- outside test war erfolglos |
||
71 | else |
||
72 | local p, w, f = wowon_geo_ball_in (b) |
||
73 | -- vorhin berechnete position für feld |
||
74 | local pos = wowon.game.ball[b].posfeld_temp |
||
75 | |||
76 | if not (p == nil) and not (pos == f) then |
||
77 | wowon_event_ballfeld (p, w, f, b) |
||
78 | wowon.game.ball[b].posfeld_temp = f |
||
79 | wowon.game.ball[b].pos_temp = nil |
||
80 | end |
||
81 | end |
||
82 | |||
83 | end |
||
84 | |||
85 | end |
||
86 | |||
87 | |||
88 | -- event ball trifft balken |
||
89 | function wowon_event_ballbalken (b) |
||
90 | -- b == ballnummer |
||
91 | |||
92 | if (wowon.game.ball[b].ss == 2) then |
||
93 | -- feuerball |
||
94 | if (wowon.game.ball[b].s == 2) then |
||
95 | -- ballstatus zu normal ändern |
||
96 | wowon.game.ball[b].s = 1 |
||
97 | wowon_UI_sf_ball_update (b) |
||
98 | end |
||
99 | wowon_geo_winkel_balken (b) |
||
100 | |||
101 | elseif (wowon.game.ball[b].ss == 4) then |
||
102 | -- balken- |
||
103 | if (wowon.game.ball[b].s == 200) then |
||
104 | -- feldball löschen |
||
105 | wowon_sf_ball_delet (b) |
||
106 | wowon_UI_GXF_sf ("balken-", b) |
||
107 | |||
108 | --balken+ |
||
109 | elseif (wowon.game.ball[b].s == 201) then |
||
110 | -- feldball löschen |
||
111 | wowon_sf_ball_delet (b) |
||
112 | wowon_UI_GXF_sf ("balken+", b) |
||
113 | |||
114 | --ball+1 |
||
115 | elseif (wowon.game.ball[b].s == 301) then |
||
116 | -- feldball löschen |
||
117 | wowon_sf_ball_delet (b) |
||
118 | wowon_sf_ball_add (1) |
||
119 | |||
120 | --ball+2 |
||
121 | elseif (wowon.game.ball[b].s == 302) then |
||
122 | -- feldball löschen |
||
123 | wowon_sf_ball_delet (b) |
||
124 | wowon_sf_ball_add (1) |
||
125 | wowon_sf_ball_add (1) |
||
126 | |||
127 | --ball+3 |
||
128 | elseif (wowon.game.ball[b].s == 303) then |
||
129 | -- feldball löschen |
||
130 | wowon_sf_ball_delet (b) |
||
131 | wowon_sf_ball_add (1) |
||
132 | wowon_sf_ball_add (1) |
||
133 | wowon_sf_ball_add (1) |
||
134 | |||
135 | end |
||
136 | end |
||
137 | end |
||
138 | |||
139 | -- event ball ist ausserhalb des sf (unter dem balken) |
||
140 | function wowon_event_ball_out (b) |
||
141 | -- b = ballnummer |
||
142 | wowon_sf_ball_delet (b) |
||
143 | -- noch ein spielball frei? |
||
144 | local x = false |
||
145 | for i = 1, table.getn(wowon.game.balle) do |
||
146 | if (wowon.game.ball[wowon.game.balle[i]].ss == 1) or (wowon.game.ball[wowon.game.balle[i]].ss == 2) then |
||
147 | x = true |
||
148 | break |
||
149 | end |
||
150 | end |
||
151 | if (x == false) then |
||
152 | wowon_exit_game () |
||
153 | wowon_UI_sf_string (false) |
||
154 | end |
||
155 | end |
||
156 | |||
157 | -- ball trifft ein feld |
||
158 | function wowon_event_ballfeld (p, w, f, b) |
||
159 | -- p = auprallpunkt |
||
160 | -- w = aufprallwinkel |
||
161 | -- f = feldnummer |
||
162 | -- b = ballnummer |
||
163 | |||
164 | |||
165 | -- fliegende feldbälle |
||
166 | if (wowon.game.ball[b].ss == 4) then |
||
167 | -- winkel ändern |
||
168 | wowon_geo_winkel (b, p, w) |
||
169 | else |
||
170 | |||
171 | if (wowon.game.feld[f].s == 1) then |
||
172 | |||
173 | -- feldbälle |
||
174 | if not (wowon.game.feld[f].fb == nil) then |
||
175 | |||
176 | -- feuerball |
||
177 | if (wowon.game.ball[wowon.game.feld[f].fb].s == 102) then |
||
178 | -- feldball löschen |
||
179 | wowon_sf_ball_delet (wowon.game.feld[f].fb) |
||
180 | -- ballstatus zu feuer ändern |
||
181 | wowon.game.ball[b].s = 2 |
||
182 | wowon_UI_sf_ball_update (b) |
||
183 | |||
184 | -- blauerball |
||
185 | elseif (wowon.game.ball[wowon.game.feld[f].fb].s == 103) then |
||
186 | -- feldball löschen |
||
187 | wowon_sf_ball_delet (wowon.game.feld[f].fb) |
||
188 | -- ballstatus zu blau ändern |
||
189 | wowon.game.ball[b].s = 3 |
||
190 | wowon_UI_sf_ball_update (b) |
||
191 | |||
192 | -- speed+ |
||
193 | elseif (wowon.game.ball[wowon.game.feld[f].fb].s == 150) then |
||
194 | -- feldball löschen |
||
195 | wowon_sf_ball_delet (wowon.game.feld[f].fb) |
||
196 | -- ballspeed um 25% erhöhen |
||
197 | wowon.game.ball[b].a = wowon.game.ball[b].a*1.25 |
||
198 | |||
199 | -- speed- |
||
200 | elseif (wowon.game.ball[wowon.game.feld[f].fb].s == 151) then |
||
201 | -- feldball löschen |
||
202 | wowon_sf_ball_delet (wowon.game.feld[f].fb) |
||
203 | -- ballspeed um 25% verringern |
||
204 | wowon.game.ball[b].a = wowon.game.ball[b].a*0.75 |
||
205 | |||
206 | -- grösse+ |
||
207 | elseif (wowon.game.ball[wowon.game.feld[f].fb].s == 152) then |
||
208 | -- feldball löschen |
||
209 | wowon_sf_ball_delet (wowon.game.feld[f].fb) |
||
210 | -- ballradiusgrösse um 50% erhöhen |
||
211 | wowon.game.ball[b].r = wowon.game.ball[b].r*1.50 |
||
212 | wowon_UI_sf_ball_update (b) |
||
213 | |||
214 | -- grösse- |
||
215 | elseif (wowon.game.ball[wowon.game.feld[f].fb].s == 153) then |
||
216 | -- feldball löschen |
||
217 | wowon_sf_ball_delet (wowon.game.feld[f].fb) |
||
218 | -- ballradiusgrösse um 50% verringern |
||
219 | wowon.game.ball[b].r = wowon.game.ball[b].r*0.5 |
||
220 | wowon_UI_sf_ball_update (b) |
||
221 | |||
222 | -- feldbälle starten |
||
223 | elseif (wowon.game.ball[wowon.game.feld[f].fb].s > 199) then |
||
224 | -- feldball starten |
||
225 | wowon_sf_feldball_start (wowon.game.feld[f].fb) |
||
226 | end |
||
227 | |||
228 | end |
||
229 | |||
230 | -- ballstatus |
||
231 | if not (wowon.game.ball[b].s == 1) then |
||
232 | -- feuerball |
||
233 | if (wowon.game.ball[b].s == 2) then |
||
234 | -- speed ändern |
||
235 | wowon.game.ball[b].a = wowon.game.ball[b].a+0.2 |
||
236 | -- feld löschen |
||
237 | wowon_sf_feld_delet (f) |
||
238 | |||
239 | -- blauerball |
||
240 | elseif (wowon.game.ball[b].s == 3) then |
||
241 | -- speed ändern |
||
242 | wowon.game.ball[b].a = wowon.game.ball[b].a+0.2 |
||
243 | -- feld löschen |
||
244 | wowon_sf_feld_delet (f) |
||
245 | -- winkel ändern |
||
246 | wowon_geo_randomwinkel (b, p, w) |
||
247 | end |
||
248 | |||
249 | else |
||
250 | --ball status = 1 |
||
251 | wowon_sf_feld_delet (f) |
||
252 | -- winkel ändern |
||
253 | wowon_geo_winkel (b, p, w) |
||
254 | -- speed ändern |
||
255 | wowon.game.ball[b].a = wowon.game.ball[b].a+0.12 |
||
256 | end |
||
257 | |||
258 | -- stahl-feld |
||
259 | elseif (wowon.game.feld[f].s == 2) then |
||
260 | -- winkel ändern |
||
261 | wowon_geo_winkel (b, p, w) |
||
262 | |||
263 | -- blau-feld |
||
264 | elseif (wowon.game.feld[f].s == 3) then |
||
265 | -- winkel ändern |
||
266 | wowon_geo_randomwinkel (b, p, w) |
||
267 | end |
||
268 | |||
269 | -- spiel beendet? |
||
270 | local donetest = true |
||
271 | for i=1, table.getn(wowon.game.felder) do |
||
272 | if (wowon.game.feld[wowon.game.felder[i]].s == 1) then |
||
273 | donetest = false |
||
274 | end |
||
275 | end |
||
276 | if (donetest == true) then |
||
277 | wowon_exit_game () |
||
278 | wowon_UI_sf_string (true) |
||
279 | end |
||
280 | end |
||
281 | |||
282 | end |
||
283 | |||
284 | |||
285 | -- mausklick im sf feld |
||
286 | function wowon_event_mausklick () |
||
287 | |||
288 | for i=1, table.getn(wowon.game.balle) do |
||
289 | local bnr = wowon.game.balle[i] |
||
290 | if (wowon.game.ball[bnr].ss == 1) then |
||
291 | -- status des balles ändern |
||
292 | wowon_sf_ball_start (bnr) |
||
293 | end |
||
294 | end |
||
295 | end |