-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
john kavanagh
committed
Aug 31, 2015
1 parent
8ee99fd
commit 1957bcd
Showing
16 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.bawsephighter; | ||
|
||
import org.andengine.entity.sprite.Sprite; | ||
import org.andengine.extension.physics.box2d.PhysicsConnector; | ||
import org.andengine.extension.physics.box2d.PhysicsFactory; | ||
import org.andengine.extension.physics.box2d.PhysicsWorld; | ||
import org.andengine.opengl.vbo.VertexBufferObjectManager; | ||
|
||
import com.badlogic.gdx.physics.box2d.Body; | ||
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; | ||
|
||
public class Boss extends Sprite { | ||
private Body body; | ||
private int health; | ||
|
||
public Boss(float pX, float pY, VertexBufferObjectManager vbo, PhysicsWorld physicsWorld){ | ||
super(pX, pY, ResourcesManager.getInstance().boss_region, vbo); | ||
health = 100; | ||
createPhysics(physicsWorld); | ||
} | ||
|
||
private void createPhysics(PhysicsWorld physicsWorld){ | ||
body = PhysicsFactory.createBoxBody(physicsWorld, this, BodyType.DynamicBody, PhysicsFactory.createFixtureDef(0, 0, 0)); | ||
body.setUserData("boss"); | ||
body.setLinearDamping(5); | ||
body.setFixedRotation(true); | ||
|
||
physicsWorld.registerPhysicsConnector(new PhysicsConnector(this, body, true, false)); | ||
} | ||
|
||
public void setX(float pX){ | ||
body.setLinearVelocity(pX, body.getLinearVelocity().y); | ||
} | ||
|
||
public void setY(float pY){ | ||
body.setLinearVelocity(body.getLinearVelocity().x, pY); | ||
} | ||
|
||
public int getLives(){ | ||
return health; | ||
} | ||
|
||
public void loseLife(){ | ||
health += -1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters