|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectapes.ImageObject
apes.CollidableImageObject
apes.Banana
public class Banana
This class represents a Banana (or really any object that may be thrown in a parabolic trajectory).
The actual current position will be saved in the position
field
of this classes super class (ImageObject
).
The position passed to the constructor will be used as current actual
position as well as spawning point in the future.
Field Summary |
---|
Fields inherited from class apes.ImageObject |
---|
image, name, position |
Constructor Summary | |
---|---|
Banana(java.lang.String name,
org.newdawn.slick.Image image,
org.newdawn.slick.geom.Vector2f position,
org.newdawn.slick.geom.Shape collisionShape)
constructs a new banana with given arguments. |
Method Summary | |
---|---|
org.newdawn.slick.geom.Vector2f |
getPositionBeforSpawn()
returns the last actual position before the last respawn. |
org.newdawn.slick.geom.Vector2f |
getSpawnPosition()
returns the position where this banana will respawn after hitting the border or a collidable object. |
org.newdawn.slick.geom.Path |
getYForX(float g,
float beta,
float vel,
org.newdawn.slick.GameContainer gc)
creates a path representing the current parabolic trajectory. |
boolean |
isMoving()
returns weather or not the banana is currently moving. |
boolean |
isStartedThrow()
returns weather or not a throw has been started. |
void |
moveBanana(float g,
float time,
org.newdawn.slick.GameContainer gc)
moves banana one step further on parabolic trajectory. |
void |
resetBanana()
returns the banana instantly to its spawn position provided at construction. |
void |
startThrow(float betaRadian,
float velocity)
starts a throw in the given angle and with the given velocity. |
Methods inherited from class apes.CollidableImageObject |
---|
getCollisionShape, getNormalCollisionShape, isCollidingWith, render, setPosition |
Methods inherited from class apes.ImageObject |
---|
getName, getPosition, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Banana(java.lang.String name, org.newdawn.slick.Image image, org.newdawn.slick.geom.Vector2f position, org.newdawn.slick.geom.Shape collisionShape)
name
- image
- position
- current actual position as well as future spawning positioncollisionShape
- Method Detail |
---|
public org.newdawn.slick.geom.Vector2f getPositionBeforSpawn()
public boolean isStartedThrow()
used by the ai.
IEnemyAI
public boolean isMoving()
public org.newdawn.slick.geom.Vector2f getSpawnPosition()
public void resetBanana()
moving
, startedThrow
and positionBeforSpawn
fields.
public void startThrow(float betaRadian, float velocity)
moving
and startedThrow
true,
resets objOnThrowParabel
to (0,0), and saves the given
arguments in this class.
It does not actually carry out the throw. To archive this, see moveBanana
.
g
- gravitybetaRadian
- the angle in radianvelocity
- the starting velocitypublic void moveBanana(float g, float time, org.newdawn.slick.GameContainer gc)
GameContainer
)
the object will be reset to its spawning position.
time
- gc
- public org.newdawn.slick.geom.Path getYForX(float g, float beta, float vel, org.newdawn.slick.GameContainer gc)
IEnemyAI
.
beta
- angle (in degrees)vel
- velocitygc
-
IEnemyAI
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |