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; //from w w w .j ava 2 s . c om import com.lucythemoocher.R; import com.lucythemoocher.Globals.Globals; import com.lucythemoocher.physics.Cinematic; import com.lucythemoocher.util.Direction; /** * Class for projectiles */ public class Projectile extends Actor { private int dir_; public Projectile(float x, float y, int direction) { super(); Globals.getInstance().getGame().getProjectilesManager().add(this); dir_ = direction; getDrawer().initializeAnimation(R.drawable.tank_projectile); if (direction == Direction.LEFT) { int tab[] = {1}; getDrawer().setAnimation(tab, 200); } else { int tab[] = {0}; getDrawer().setAnimation(tab, 200); } setCinematic(new Cinematic(0.75f, false)); getCinematic().addBox(x, y, getH(), getW()); } public void update() { super.update(); if (dir_ == Direction.LEFT) { moveLeft(); } else { moveRight(); } if (getCinematic().hasLeftCollision() || getCinematic().hasRightCollision()) { setToRemove(); } } }