input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public vector scalar multiplication double s return new vector x s y s
|
multiples the values of the vector with a given scalar
|
public void select previous int item current item 1 if item 0 item menu items length 1 skip disabled menu items while menu items item get enabled item if item 0 item menu items length 1 menu items current item set selected false menu items item set selected true current item item
|
select the previous enabled item in the menu
|
public vector scalar division double s return new vector x s y s
|
divides the vector length by a scalar number
|
public void select next int item current item 1 if item menu items length item 0 skip disabled menu items while menu items item get enabled item if item menu items length item 0 menu items current item set selected false menu items item set selected true current item item
|
select the next enabled item in the menu
|
public double cross product vector v return this x v y this y v x
|
returns the value of the cross product of this vector with a second
|
public vector project vector v double v length squared v x v x v y v y double scalar prod dot product v return v scalar multiplication scalar prod v length squared
|
returns the projection of this vector on a second vector c
|
public vector add vector v return new vector x v x y v y
|
returns the sum of a given vector and this vector
|
public vector subtract vector v return new vector x v x y v y
|
returns the subtraction of a given vector from this vector
|
public void keyboard action string id boolean down if down return if dialog null if id equals down select next if id equals up select previous else if id equals right dialog change 1 if id equals left dialog change 1
|
key handling function called by menu state
|
public vector normalize double mag math sqrt x x y y return new vector x mag y mag
|
normalizes the vector and returns the result
|
public string get selected if dialog null return menu items current item get action if dialog get value dialog null return confirm menu items current item get action else dialog null return null
|
get the name of the selected menu item
|
public vector perpendicular cw return new vector y x
|
returns a vector of the same length that is
|
public vector perpendicular ccw return new vector y x
|
returns a vector of the same length that is
|
public menu item get current menu item return menu items current item
|
get the selected menu item of this menu
|
public vector mirror y return new vector get x get y
|
returns a vector which is mirrored on the y axis
|
public vector mirror x return new vector get x get y
|
returns a vector which is mirrored on the x axis
|
public void logic if menu items current item get enabled set current item current item 1
|
a method for doing all game logic of the menu
|
public boolean has zero length if x 0 y 0 return true return false
|
returns true if the vector has a length of zero
|
public void show confirm dialog dialog new confirm dialog confirm menu items current item get sprite get id
|
show a confirmation dialog for the current menu item
|
public boolean same direction vector v return direction check v 0
|
checks if the direction of the vector is the same
|
public confirm dialog get confirm dialog return dialog
|
return the currently showing confirmation dialog
|
public boolean opposite direction vector v return direction check v 0
|
checks if the direction of the vector is the
|
public void set selected boolean value selected value if selected sprite set animation selected alt sprite set animation selected else sprite set animation idle alt sprite set animation idle
|
mark this menu item as selected or
|
public void add menu menu menu menus put menu get id menu
|
adds a menu object to the menu manager
|
public menu get menu string id return menus get id
|
get a menu from the manager
|
public vector rotate around double rot vector pivot vector v subtract pivot return v rotate rot add pivot
|
rotate a vector around another vector
|
public void shoot if get weapon null get weapon shoot
|
shoot a bullet with the current weapon
|
public vector rotate double rot rot rot math pi 180 0 return new vector get x math cos rot get y math sin rot get x math sin rot get y math cos rot
|
rotate a vector around origo
|
public void set aim double x double y get weapon set aim x y
|
makes the unit aim at the given x and y position
|
public sprite get sprite if alternate return alt sprite else return sprite
|
get the sprite object of the menu item
|
public void set invincibility timer int invincibility timer this invincibility timer invincibility timer
|
set the duration for the invincibility timer
|
public double get rotation return math atan2 x y 180 math pi 90
|
get the rotation of the vector in degrees
|
public int get invincibility timer return invincibility timer
|
get the remaining duration of the invincibility timer
|
public level get level return current level
|
returns the current level
|
public void set ground contact vector vector ground contact vector this ground contact vector ground contact vector
|
sets the ground contact vector for the unit
|
public void set level level level current level level player set position level get start position current level set player player
|
set the current level
|
public boolean get alternate return alternate
|
get whether the alternate text is the currently set one
|
public vector get ground contact vector return ground contact vector
|
returns the ground contact normal of the unit
|
public void keyboard action string id boolean down if id equals moveleft get player move left down if id equals moveright get player move right down if id equals jump get player jump or flap down
|
delegates actions to the right objects
|
public void set health int health this health health if this health 100 this health 100
|
sets the health of the unit
|
public polygon get collision data boolean transformed list vector verts new array list vector collision data get vertices size if transformed verts add all collision data get vertices else for vector v collision data get vertices v v scalar multiplication get scale add get position verts add v return new polygon verts
|
returns the collision data of the object
|
public void add game object abstract game object agb get level add game object agb
|
adds an abstract game object to the current level
|
public polygon get collision data return get collision data false
|
returns this objects collision data in object local coordinates
|
public void mouse action int button double x double y boolean mouse down if button 1 get player shoot toggle mouse down else if button 3 get player jump or flap mouse down
|
delegates mouse press events to game logic
|
public void mouse move double x double y convert from screen coordinates to world coordinates vector world aim screen screen to world coordinates new vector x y get player get position get player set aim world aim get x world aim get y
|
delegates mouse movement events to game logic
|
public void set aicontrolled boolean is aicontrolled this is aicontrolled is aicontrolled
|
controls whether the unit is ai controlled or not
|
public void set collision data polygon collision data make sure the collision data is valid the polygon must be convex if polygon check convexity collision data throw new illegal argument exception collisiondata polygon is not convex else if polygon check ccw collision data collections reverse collision data get vertices this collision data collision data
|
sets the collision data to the given polygon
|
public boolean is aicontrolled return is aicontrolled
|
returns true if the unit is ai controlled
|
public void set weapon weapon weapon this weapon weapon add child weapon
|
set the weapon for the unit
|
public void aim at player player p get level get player double pdx p get x get x set aim p get x p get y math abs pdx 6 set direction p get x get x 0 1 1
|
make the enemy aim at the players position
|
protected vector get weapon offset return weapon offset scalar multiplication get scale
|
get the offset of the weapon relative to the
|
protected void set weapon offset vector weapon offset this weapon offset weapon offset
|
set the offset of the weapon relative to the
|
public polygon get surface return get collision data
|
returns the polygon object forming this terrain section
|
public void set melee damage int damage this melee damage damage
|
sets the amount of damage this enemy does to the player
|
public void set health points int health points this health points health points
|
sets the amount of health this item gives the player
|
public int get health points return health points
|
returns the amount of health this item gives the player
|
public int get melee damage return melee damage
|
gets the amount of damage this enemy does to the player
|
public double get mass return mass get scale
|
returns the mass of the object
|
public void add terrain section terrain section t terrain sections add t
|
adds a terrain section to the level
|
public void set sight distance double sight distance this sight distance sight distance
|
set the sight distance for finding the player
|
public double get sight distance return sight distance
|
get the sight distance for finding the player
|
public void add game object abstract game object go game objects add go go set level this
|
adds an abstract game object to the level
|
public void set x double x position new vector x position get y
|
assigns a double to the world coordinate in the x axis
|
public void set aim double x double y double dx x get x double dy y get y double rotation math to degrees math atan2 dx dy 90 if rotation 90 rotation 270 get sprite set mirrored true rotation 180 else get sprite set mirrored false get sprite set rotation rotation aim x dx aim y dy
|
aims the weapon towards the given world coordinates
|
public void shoot if cooldown timer 0 owner get level schedule for addition new projectile get position add get sprite get mirrored get nozzle offset rotate get sprite get rotation get nozzle offset mirror y rotate get sprite get rotation new vector aim x aim y get nozzle speed get owner cooldown timer get cooldown
|
makes the weapon shoot
|
public void set attack timer int attack timer this attack timer attack timer
|
set the interval at which the enemy attacks
|
public void add game object collection abstract game object go game objects add all go for abstract game object g go g set level this
|
adds an abstract game object to the level
|
public void set y double y position new vector position get x y
|
assigns a double to the world coordinate in the y axis
|
public void set background tex id string background tex id this background tex id background tex id
|
get the id for the texture used as the background
|
public void set position vector v position v
|
set the world coordinate of the object to the given vector
|
public int get attack timer return attack timer
|
set the interval at which the enemy attacks
|
public string get background tex id return background tex id
|
set the id for the texture used as the background
|
public void translate vector v position position add v
|
translate the object by the given vector
|
public void set owner abstract game object owner this owner owner
|
set the owner of the weapon
|
public void set velocity vector v velocity v
|
sets the velocity of the object to the given vector
|
public abstract game object get owner return owner
|
returns the owner of the weapon
|
public void set force vector force this force force
|
sets the current force acting on the object
|
public void set player player player this player player if game objects contains player add game object player
|
set the player object in this level
|
public int get cooldown return cooldown
|
returns the cooldown time in gameframes of the weapon
|
public boolean has collided return has collided
|
returns true if the projectile has collided
|
public void apply force vector v force force add v
|
sets the current force acting on the object
|
public void set has collided boolean has collided this has collided has collided
|
set the projectiles collision status
|
public void set cooldown int cooldown this cooldown cooldown
|
sets the cooldown time gameframes of the weapon
|
public void set nozzle offset vector nozzle offset this nozzle offset nozzle offset
|
sets the nozzle offset of the weapon
|
public void schedule for addition abstract game object game object scheduled for addition add game object
|
schedule an object for addition to the level at the next
|
public vector get nozzle offset return nozzle offset scalar multiplication get scale
|
returns the nozzle offset of the weapon
|
public int get time in curr dir return time in curr dir
|
returns the number of frames the enemy has been walking in the current
|
public void update forces
|
method to be overridden by objects that have additional movement logic
|
public void set start position vector start position this start position start position
|
set the start position for the player on this level
|
public void set nozzle speed double nozzle speed this nozzle speed nozzle speed
|
sets the exit speed of the projectile this weapon shoots
|
public double get nozzle speed return nozzle speed
|
returns the exit speed of the projectile this weapon shoots
|
public game round message update return game round message no event
|
method to be overridden by objects that have
|
private void set time in curr dir int time in curr dir this time in curr dir time in curr dir
|
sets the number of frames the enemy has been walking in the current
|
public vector get start position return start position
|
get the start position for the player on this level
|
public int get number return level number
|
get the level number for this level
|
public void add level level level levels add level
|
adds a level object to the level manager
|
public void set number int level number this level number level number
|
set the level number for this level
|
public level get level int level number return level levels get level number 1 levels size clone
|
get a level from the manager
|
public void set sprite sprite sprite this sprite sprite
|
sets the sprite of the object
|
public int number of levels return levels size
|
returns the number of levels held by the level manager
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.