/android/Android(LGame-0.3.2&LAE-1.1)/LGame-0.3.2(OpenGLES)/src/other/stg/org/loon/framework/android/game/stg/enemy/EnemyTongue.java

http://loon-simple.googlecode.com/ · Java · 62 lines · 34 code · 8 blank · 20 comment · 11 complexity · 10b58d069b28a881a2e967f31f0e4cbf MD5 · raw file

  1. package org.loon.framework.android.game.stg.enemy;
  2. import org.loon.framework.android.game.stg.STGObject;
  3. import org.loon.framework.android.game.stg.STGScreen;
  4. /**
  5. * Copyright 2008 - 2011
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  8. * use this file except in compliance with the License. You may obtain a copy of
  9. * the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations under
  17. * the License.
  18. *
  19. * @project loonframework
  20. * @author chenpeng
  21. * @email??šceponline@yahoo.com.cn
  22. * @version 0.1
  23. */
  24. public abstract class EnemyTongue extends STGObject {
  25. String explosion;
  26. public EnemyTongue(STGScreen stg, int no, int x, int y, int tpno) {
  27. super(stg, no, x, y, tpno);
  28. super.attribute = STGScreen.ENEMY;
  29. super.hitPoint = 10000;
  30. super.countUpdate = 20;
  31. }
  32. public void beDestroyed() {
  33. this.scrollMove();
  34. if (this.count == 0) {
  35. if (explosion != null) {
  36. addClass(explosion, getX(), getY(), super.plnNo);
  37. } else {
  38. onExplosion();
  39. }
  40. } else if (this.count > countUpdate || getY() > getScreenHeight()) {
  41. delete();
  42. }
  43. ++this.count;
  44. if (this.count % 2 == 0) {
  45. setPlaneView(false);
  46. } else {
  47. setPlaneView(true);
  48. }
  49. }
  50. public void update() {
  51. beDestroyed();
  52. }
  53. public abstract void onExplosion();
  54. }