comparison webGL/dandy/resources/Character_state.js @ 13:4684e849866c

upload
author NOBUYASU Oshiro
date Sat, 17 Jul 2010 01:26:32 +0900
parents 61febc94fa62
children a2b31fe50d9d
comparison
equal deleted inserted replaced
12:61febc94fa62 13:4684e849866c
90 else p.state = chara_state5; 90 else p.state = chara_state5;
91 //PutSprite(count, p.x, p.y, p.charano); 91 //PutSprite(count, p.x, p.y, p.charano);
92 return p; 92 return p;
93 } 93 }
94 94
95 chara_state6 = function character_state7(p) 95 chara_state6 = function character_state6(p)
96 { 96 {
97 p.y += p.vy; 97 p.y += p.vy;
98 p.x += p.vx; 98 p.x += p.vx;
99 if(p.y + 96 < jiki.y 99 if(p.y + 96 < jiki.y
100 && p.y + 128 > jiki.y) 100 && p.y + 128 > jiki.y)
125 // stage1 boss patern 125 // stage1 boss patern
126 chara_state8 = function character_state8( p ) 126 chara_state8 = function character_state8( p )
127 { 127 {
128 if(p.y < 520*d_y) 128 if(p.y < 520*d_y)
129 { 129 {
130 p.y -= p.vy; 130 p.y += p.vy;
131 tekino0 = p;
132 count++;
131 /* 133 /*
132 tekino0 = p;
133 kyeenmyno = p; 134 kyeenmyno = p;
134 count++;
135 DefSpriteEx(p.charano, 16*4, 32*4); 135 DefSpriteEx(p.charano, 16*4, 32*4);
136 PutSpriteEx(p.charano, (p.x * 4), (p.y * 4), 0.2, 0.2, 1); 136 PutSpriteEx(p.charano, (p.x * 4), (p.y * 4), 0.2, 0.2, 1);
137 */ 137 */
138
138 p.dt1 = 512; 139 p.dt1 = 512;
139 p.s = 0.125; 140 p.s = 0.125;
140 p.state = chara_state8; 141 p.state = chara_state8;
141 return p; 142 return p;
142 } 143 }
144 return p; 145 return p;
145 } 146 }
146 147
147 chara_state9 = function character_state9( p ) 148 chara_state9 = function character_state9( p )
148 { 149 {
149
150 if(p.s <= 2) 150 if(p.s <= 2)
151 { 151 {
152 p.s += 0.05 152 p.s += 0.05
153 p.y += 0.12; 153 p.y -= 12*d_y;
154 count++; 154 count++;
155 // DefSpriteEx(54, 16*4, 32*4); 155 // DefSpriteEx(54, 16*4, 32*4);
156 // PutSpriteEx(54, (p.x * 4), (p.y * 4), p.x, p.x, 1); 156 // PutSpriteEx(54, (p.x * 4), (p.y * 4), p.x, p.x, 1);
157 p.state = chara_state9; 157 p.state = chara_state9;
158 return p; 158 return p;
159 } 159 }
160 count++; 160 count++;
161 rinkx = p.x; 161 rinkx = p.x/d_x;
162 rinky = p.y; 162 rinky = p.y/d_y;
163 // DefSpriteEx(54, 16,32); 163 // DefSpriteEx(54, 16,32);
164 // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1); 164 // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1);
165 // Putenemy(5, rinkx - 16, rinky -16, 1, 0, chara_state10); 165 // Putenemy(5, rinkx - 16, rinky -16, 1, 0, chara_state10);
166 // Putenemy(5, rinkx - 16, rinky -16, -1, 0, chara_state10); 166 // Putenemy(5, rinkx - 16, rinky -16, -1, 0, chara_state10);
167 PutBoss(2, rinkx - 16, rinky -16, 1, 0, chara_state10); 167
168 PutBoss(2, rinkx - 16, rinky -16, -1, 0, chara_state10); 168 PutBoss(2, rinkx - 16*d_x, rinky -16*d_y, 1, 0, chara_state10);
169 PutBoss(2, rinkx - 16*d_x, rinky -16*d_y, -1, 0, chara_state10);
169 170
170 p.state = chara_state11; 171 p.state = chara_state11;
171 p.dt1 = 8192; 172 p.dt1 = 8192;
172 173
173 return p; 174 return p;
206 return p; 207 return p;
207 } 208 }
208 209
209 chara_state12 = function character_state12( p ) 210 chara_state12 = function character_state12( p )
210 { 211 {
211 if(fastebos > 60+60) 212 if(fastebos > 60*60)
212 { 213 {
213 if(p.y > 70+boss[1].h) 214 // if(p.y > 70+boss[1].h)
215 if(p.y > (240+32)*d_y)
214 { 216 {
215 p.state = delete_chara; 217 p.state = delete_chara;
216 } 218 }
217 p.y += 0.3; 219 p.y += 0.3*d_y;
218 rinky += 0.3; 220 rinky += 0.3*d_y;
219 count++; 221 count++;
220 // DefSpriteEx(54, 16, 32); 222 // DefSpriteEx(54, 16, 32);
221 // PutSpriteEx(54, p.x, p.y, 2, 2, 1); 223 // PutSpriteEx(54, p.x, p.y, 2, 2, 1);
222 p.state = chara_state12; 224 p.state = chara_state12;
223 return p; 225 return p;
224 } 226 }
225 if(p.dt1 <= 60) 227 if(p.dt1 <= 60)
226 { 228 {
227 if(jiki.x + 15 -rinkx < -5) 229 if(jiki.x + 15*d_x -rinkx < -5*d_x)
228 { 230 {
229 p.vx = -0.3; 231 p.vx = -0.3 * d_x;
230 } 232 }
231 else if(jiki.x + 15 - rinkx > 5) 233 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
232 { 234 {
233 p.vx = +0.8; 235 p.vx = +0.8 * d_x;
234 } 236 }
235 else p.vx = 0; 237 else p.vx = 0;
236 rinkx = p.x; 238 rinkx = p.x;
237 rinky = p.y; 239 rinky = p.y;
238 } 240 }
239 if((p.dt1 > 60) && (p.dt1 <= 70)) 241 if((p.dt1 > 60) && (p.dt1 <= 70))
240 { 242 {
241 if(p.dt1 % 2 == 1) 243 if(p.dt1 % 2 == 1)
242 { 244 {
243 // Puttama(0, rinkx - 16, rinky); 245 Puttama(0, rinkx - 16 , rinky);
244 // Puttama(0, rinkx, rinky); 246 Puttama(0, rinkx, rinky);
245 // Puttama(0, rinkx + 16, rinky); 247 Puttama(0, rinkx + 16, rinky);
246 } 248 }
247 } 249 }
248 if((p.dt1 > 180) && (p.dt1 <= 240)) 250 if((p.dt1 > 180) && (p.dt1 <= 240))
249 { 251 {
250 if(p.dt1 % 2 == 1) 252 if(p.dt1 % 2 == 1)
251 { 253 {
252 rinkf2 = 1; 254 rinkf2 = 1;
253 // Puttama(2, rinkx - 16, p.y -32); 255 Puttama(2, rinkx - 16, p.y -32);
254 // Puttama(3, rinkx + 32 - 16, p.y - 32); 256 Puttama(3, rinkx + 32 - 16, p.y - 32);
255 } 257 }
256 else 258 else
257 { 259 {
258 rinkf2 = 2; 260 rinkf2 = 2;
259 } 261 }
268 // PutSprite(count, rinkx - 16, rinky + 32, 58 + p.dt1 %4) 270 // PutSprite(count, rinkx - 16, rinky + 32, 58 + p.dt1 %4)
269 } 271 }
270 if((p.dt1 > 300) && (p.dt1 <= 400)) 272 if((p.dt1 > 300) && (p.dt1 <= 400))
271 { 273 {
272 rinkf2 = 3; 274 rinkf2 = 3;
273 if(jiki.x + 15 - rinkx < -5) 275 if(jiki.x + 15*d_x - rinkx < -5*d_x)
274 { 276 {
275 p.vx = -1; 277 p.vx = -1 * d_x;
276 } 278 }
277 else if(jiki.x + 15 - rinkx > 5) 279 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
278 { 280 {
279 p.vx = +1; 281 p.vx = +1 * d_x;
280 } 282 }
281 else p.vx = 0; 283 else p.vx = 0;
282 p.x += p.vx; 284 p.x += p.vx;
283 rinkx = p.x; 285 rinkx = p.x;
284 rinky = p.y; 286 rinky = p.y;
285 // Puttama(4, rinkx - 8, rinky + 16); 287 Puttama(4, rinkx - 8, rinky + 16);
286 } 288 }
287 if((p.dt1 > 400) && (p.dt1 <= 500)) 289 if((p.dt1 > 400) && (p.dt1 <= 500))
288 { 290 {
289 rinkf2 = 4; 291 rinkf2 = 4;
290 if(jiki.x + 15 - rinkx > 5) 292 if(jiki.x + 15*d_x - rinkx > 5*d_x)
291 { 293 {
292 p.vx = -1; 294 p.vx = -1*_dx;
293 } 295 }
294 else if(jiki.x + 15 - rinkx >5) 296 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
295 { 297 {
296 p.vx = +1; 298 p.vx = +1*d_x;
297 } 299 }
298 else p.vx = 0; 300 else p.vx = 0;
299 p.x += p.vx; 301 p.x += p.vx;
300 rinkx = p.x; 302 rinkx = p.x;
301 rinky = p.y; 303 rinky = p.y;
302 } 304 }
303 if(p.dt1 > 500) 305 if(p.dt1 > 500)
304 { 306 {
305 rinkf2 = 5; 307 rinkf2 = 5;
306 if(jiki.x + 15 - rinkx < -5) 308 if(jiki.x + 15*d_x - rinkx < -5*d_x)
307 { 309 {
308 p.vx = -1; 310 p.vx = -1*d_x;
309 } 311 }
310 else if(jiki.x + 15 - rinkx > 5) 312 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
311 { 313 {
312 p.vx = +1; 314 p.vx = +1*d_x;
313 } 315 }
314 else p.vx = 0; 316 else p.vx = 0;
315 p.x += p.vx; 317 p.x += p.vx;
316 rinkx = p.x; 318 rinkx = p.x;
317 rinky = p.y; 319 rinky = p.y;
333 335
334 chara_state13 = function character_state13(p) 336 chara_state13 = function character_state13(p)
335 { 337 {
336 if(tekino0.flag == false) 338 if(tekino0.flag == false)
337 { 339 {
338 // Bom(p.x, p.y); 340 Bom(p.x, p.y);
339 p.flag = false; 341 p.flag = false;
340 p.state = delete_chara; 342 p.state = delete_chara;
341 p.collision = noaction; 343 p.collision = noaction;
342 return p; 344 return p;
343 } 345 }
344 p.x += rinkx - p.dt1; 346 p.x += rinkx*d_x - p.dt1*d_x;
345 p.y += rinky -p.dt2; 347 p.y += rinky*d_y -p.dt2*d_y;
346 p.dt1 = rinkx; 348 p.dt1 = rinkx;
347 p.dt2 = rinky; 349 p.dt2 = rinky;
348 if(rinkf2 == 1) 350 if(rinkf2 == 1)
349 { 351 {
350 if(p.x > rinkx) 352 if(p.x > rinkx * d_x)
351 { 353 {
352 Puttama(2, p.x + 32, p.y); 354 Puttama(2, p.x + 32, p.y);
353 } 355 }
354 } 356 }
355 if(rinkf2 == 4) 357 if(rinkf2 == 4)
357 count++; 359 count++;
358 // PutSprite(count, p.x, p.y + 56, 58+filpcount % 4); 360 // PutSprite(count, p.x, p.y + 56, 58+filpcount % 4);
359 } 361 }
360 if(rinkf2 == 5) 362 if(rinkf2 == 5)
361 { 363 {
362 if(p.x > rinkx) 364 if(p.x > rinkx*d_x)
363 { 365 {
364 // Puttama(5, p.x + 8, p.y + 24); 366 Puttama(5, p.x + 8 , p.y + 24);
365 } 367 }
366 if(p.x < rinkx) 368 if(p.x < rinkx*d_x)
367 { 369 {
368 // Puttama(5, p.x + 8, p.y + 24); 370 Puttama(5, p.x + 8, p.y + 24);
369 } 371 }
370 } 372 }
371 return p; 373 return p;
372 } 374 }
375
376
377 chara_state20 = function character_state(p)
378 {
379 p.x += p.vx;
380 p.y += p.vy;
381 p.vx -= 0.5*d_x;
382 p.vy += 0.4*d_y;
383 return p;
384 }
385
386 chara_state21 = function character_state(p)
387 {
388 p.x += p.vx;
389 p.y += p.vy;
390 p.vx += 0.5*d_x;
391 p.vy += 0.4*d_y;
392 return p;
393 }