Back to project page LucyTheMoocher.
The source code is released under:
MIT License
If you think the Android project LucyTheMoocher listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.lucythemoocher.actors.maincharacter.state; /*ww w . j av a 2 s . c om*/ import com.lucythemoocher.actors.PlayerCharacter; import com.lucythemoocher.graphics.Animation; import com.lucythemoocher.physics.Cinematic; import com.lucythemoocher.util.Direction; public class StateAttack extends State { public StateAttack(PlayerCharacter pc, Cinematic pos, Animation anim, int dir) { super(pc, pos, anim, dir); if ( dir == Direction.LEFT ) { int tab[] = {32,33,34,35}; anim_.setAnimation(tab, ANIMATION_SPEED); } else { int tab[] = {28,29,30,31}; anim_.setAnimation(tab, ANIMATION_SPEED); } pc_.getDrawer().enablePersistence(150); } public void update() { super.update(); pos_.moveDown(); if ( pos_.hasDownCollision() ) { onLeave(); pc_.changeState(new StateNone(pc_, pos_, anim_, dir_)); } } /** * Called when the state ends */ public void onLeave() { pc_.getDrawer().disablePersistence(); } public boolean isAttacking() { return true; } }