Package com.dicycat.kroy.bullets
Class Bullet
- java.lang.Object
-
- com.dicycat.kroy.GameObject
-
- com.dicycat.kroy.bullets.Bullet
-
public class Bullet extends GameObject
Projectile fired by hostile entities- Author:
- Riju De
-
-
Constructor Summary
Constructors Constructor Description Bullet(com.badlogic.gdx.math.Vector2 spawnPos, com.badlogic.gdx.math.Vector2 direction, int speed, float range)
-
Method Summary
Modifier and Type Method Description void
changeDirection(com.badlogic.gdx.math.Vector2 newDir)
Calculate velocity of the bullet (Translation per frame)void
fire(com.badlogic.gdx.math.Vector2 initial)
Reactivate the bullet and reset positioncom.badlogic.gdx.math.Circle
GetHitbox()
void
update()
Called every frame.-
Methods inherited from class com.dicycat.kroy.GameObject
changePosition, die, getCentre, getHeight, getOriginX, getOriginY, getPosition, getRotation, getSprite, getTexture, getTextureHeight, getTextureWidth, getWidth, getX, getXScale, getY, getYScale, isDisplayable, isRemove, render, setPosition, setRemove, setRotation
-
-
-
-
Constructor Detail
-
Bullet
public Bullet(com.badlogic.gdx.math.Vector2 spawnPos, com.badlogic.gdx.math.Vector2 direction, int speed, float range)
- Parameters:
spawnPos
- Position to spawn the bulletdirection
- direction the bullet will travel inspeed
- speed the bullet should travel atrange
- distance the bullet should travel before it is removed
-
-
Method Detail
-
fire
public void fire(com.badlogic.gdx.math.Vector2 initial)
Reactivate the bullet and reset position- Parameters:
initial
- position to set at
-
changeDirection
public void changeDirection(com.badlogic.gdx.math.Vector2 newDir)
Calculate velocity of the bullet (Translation per frame)- Parameters:
newDir
- New direction of the bullet
-
update
public void update()
Description copied from class:GameObject
Called every frame. Update the game object.- Specified by:
update
in classGameObject
-
GetHitbox
public com.badlogic.gdx.math.Circle GetHitbox()
-
-