/android/Android(LGame-0.3.2&LAE-1.1)/LGame-0.3.2(OpenGLES)/src/other/srpg/org/loon/framework/android/game/srpg/effect/SRPGRCohesionEffect.java

http://loon-simple.googlecode.com/ · Java · 69 lines · 40 code · 9 blank · 20 comment · 2 complexity · 6bc8882d91f867e0a9248f44b4ac8f50 MD5 · raw file

  1. package org.loon.framework.android.game.srpg.effect;
  2. import org.loon.framework.android.game.core.LSystem;
  3. import org.loon.framework.android.game.core.graphics.opengl.GLColor;
  4. import org.loon.framework.android.game.core.graphics.opengl.GLEx;
  5. import org.loon.framework.android.game.srpg.SRPGDelta;
  6. /**
  7. * Copyright 2008 - 2011
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  10. * use this file except in compliance with the License. You may obtain a copy of
  11. * the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  17. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  18. * License for the specific language governing permissions and limitations under
  19. * the License.
  20. *
  21. * @project loonframework
  22. * @author chenpeng
  23. * @email??šceponline@yahoo.com.cn
  24. * @version 0.1
  25. */
  26. public class SRPGRCohesionEffect extends SRPGEffect {
  27. private int t_x, t_y;
  28. private GLColor color;
  29. private SRPGDelta[] delta;
  30. public SRPGRCohesionEffect(int x, int y) {
  31. this(x, y, GLColor.orange);
  32. }
  33. public SRPGRCohesionEffect(int x, int y, GLColor color) {
  34. this.t_x = x;
  35. this.t_y = y;
  36. this.color = color;
  37. double[][] res = { { 0.0D, 30D }, { 24D, -15D }, { -24D, -15D } };
  38. this.delta = new SRPGDelta[8];
  39. delta[0] = new SRPGDelta(res, 2D, 0.0D, 36D);
  40. delta[1] = new SRPGDelta(res, 0.0D, 2D, 36D);
  41. delta[2] = new SRPGDelta(res, -2D, 0.0D, 36D);
  42. delta[3] = new SRPGDelta(res, 0.0D, -2D, 36D);
  43. delta[4] = new SRPGDelta(res, 1.3999999999999999D, 1.3999999999999999D, 36D);
  44. delta[5] = new SRPGDelta(res, -1.3999999999999999D, 1.3999999999999999D, 36D);
  45. delta[6] = new SRPGDelta(res, 1.3999999999999999D, -1.3999999999999999D, 36D);
  46. delta[7] = new SRPGDelta(res, -1.3999999999999999D, -1.3999999999999999D,
  47. 36D);
  48. setExist(true);
  49. }
  50. public void draw(GLEx g, int x, int y) {
  51. next();
  52. g.setColor(color);
  53. for (int i = 0; i < delta.length; i++) {
  54. delta[i].drawPaint(g, t_x - x, LSystem.screenRect.height - (t_y - y));
  55. }
  56. if (super.frame > 40) {
  57. setExist(false);
  58. }
  59. }
  60. }