Kevin Song
I'm a student at UT (that's the one in Austin) who studies things.
A genre that focuses on jump timing and distances
Requires physics, collision detection, and precise input handling
Small irritations can rapidly build up into huge ones!
Thanks Bing
Instead, apply a mix of forces depending on player state that are tuned to produce the desired effect.
When the character is grounded and an input is made
When the character is airborne
When the character is grounded and jump is input:
What if jump is input while character is airborne?
Control is more important than realism!
Consider a ground-air transition on a slope.
If we want the character left and character right to look different, we typically have to draw different sprites.
Use scale to flip the direction the character is facing.
Use scale to flip the direction the character is facing.
But for most sprites you can pretend that it is!
If the game has multiple air jumps, we have to check whether the character is airborne and decrement the jump counter, then reset when we hit the ground.
For simplicity, we usually use a "ground box," an AABB which detects collisions with platforms.
Ground Box
When the ground box intersects platform geometry, play the landing animation and then set character state to landed.
Does ground box check always have to be active?
A hitbox is a box (usually AABB) which does damage. Represents the hurt-y part of an attack (like a sword blade or a laser beam).
A hurtbox is a box (usually AABB) which can take damage. Represents the squishy parts of a character.
Damage states occur when a hitbox intersects a hurtbox.
pew
But this requires more design time---always a tradeoff!
Still exist in 3D games! Use bounding volumes instead of 2D boxes, or tie controls to screen space.
...now what?
A state where the player has taken damage.
Suppose a player has taken damage and wants to jump as soon as hitstun ends.
How should we handle this?
A) The player has to input a jump once hitstun has ended
B) If the player inputs a jump during hitstun, it is stored and applied once hitstun is over.
C) The player should get good and avoid being hit, like, ever.
Input buffering stores player actions when in an inactionable state and applies them afterwards.
One potential implementation of input buffering:
public enum KeyInput {
UP, DOWN, LEFT, RIGHT }
boolean [] keyBuffer = new boolean[4];
boolean keyBuffered(KeyInput k){
int index = k.ordinal();
if(keyBuffer[index]){
keyBuffer[index] = false;
return true;
}
return false;
}
// or add this line at the top of your file
import processing.sound.*;
Library contains lots of useful functions for sound manipulation and analysis, including:
If you need more functionality, look into Minim: https://github.com/ddf/Minim
SoundFile allows playback and manipulation of sound files
Sound playback can start with the start of program, or can be triggered by specific actions
By Kevin Song
I'm a student at UT (that's the one in Austin) who studies things.