Player Motion and Graphics

Friction
A SurfaceFriction property will be added to tiles. Its type is Single and it measure deceleration across the top surface of the tile in pixels per second squared. Sprites, not moving on their own, will be subject to friction while standing on these tiles. The value will be added to or subtracted from the sprite's acceleration depending on the direction the sprite is travelling. A sprite moving left will have positive (rightward) friction applied, and a sprite moving right with have negative (leftward) acceleration applied. Friction applies equally on rectangular and sloped tiles.

Low surface friction values are useful for icy tiles; medium-low values are useful for slick or slippery tiles; high values are useful for sticky tiles. Avoid using zero or negative values, as zero will negate all friction on the tile and negative values will actually accelerate sprites.

An AirFriction property will be added to sections, and it behaves much like a tile's SurfaceFriction property, except that it is applied continuously throughout a section. While standing on a tile, the AirFriction and SurfaceFriction are summed for the sprite's friction. In non-water levels, this value should be zero, and in water levels, this value should be non-zero. Levels in fluids with different viscosities may adjust the friction value as necessary. AirFriction should not be used to simulate wind; this functionality will be added at a later time.

Definable properties:
 * SurfaceFriction: Single-precision float, represented as deceleration in pixels per second. Must not be negative.
 * AirFriction: Single-precision float, represented as deceleration in pixels per second. Must not be negative.

Walking
A player will walk when the user presses the Left or Right action buttons without pressing any other buttons. The player instantly accelerates to and maintains a walking velocity. If the user releases the button, they begin to decelerate due to surface and/or air friction. If the player falls off a ledge with or without the button being pressed, they will continue forward at their walking velocity as they fall.

Definable properties:
 * Walking Velocity: Single-precision float, represented as pixels per second.

Running
A player will run when the user presses the Left or Right action buttons while also holding Run or Alt Run. The player will immediately accelerate to walking speed and then linearly accelerate to a maximum running speed. The rate of acceleration is defined as the amount of time it takes to accelerate from walking to running speed. If the user releases Run or Alt Run, the player will decelerate to walking speed due to friction. If the user releases Left or Right, the player will decelerate to a stop.

Definable properties:
 * Running Velocity: Single-precision float, represented as pixels per second.
 * Time to Accelerate: Single-precision float, represented in seconds.

Jumping
A player jumps when the user presses the Jump action button. A jump presents itself as a sudden jolt of upward velocity which, at the least, rises the player to a defined minimum height at a defined jump velocity. If the user holds down the button for longer, the player will rise to one of two defined maximum jump heights; one for standing or walking jumps, and another for running jumps.

The standing/walking jump height will be achieved when the player jumps while having either no velocity or walking velocity in either direction. There is no linear progression; if the player jumps 4 tiles high while walking, they will jump 4 tiles high at half of walking speed, or at no speed.

If the player is moving faster than walking speed but slower than running speed, their jump height will increase linearly between the standing/walking jump height and the running jump height. At full running speed, and even at higher speeds that might be attained through event scripting or moving layers, the player will jump no higher than the running jump height.

A jump is initiated as a immediate negative change in velocity that persists for a minimum number of frames up to a maximum number of frames while the jump key is held. These numbers of frames are referred to as the jump timeouts, minimum and maximum. An integer is used to store the currently remaining number of frames before the jump stops, and this is decremented every frame. This might be changed to seconds.

Once the timeout value hits zero, the player's upward velocity will now be affected by gravity and will diminish over time, eventually leading the player back downward.

The player also has full air control while in midair - that is, the player can freely move left or right while in midair as if they were on the ground.

Definable properties:
 * JumpImpulse: A unit, measured in pixels per second, that becomes the player's upward velocity while the player is jumping.
 * MinimumJumpTimeout: A unit, either frames or seconds (haven't decided yet), which is the minimum amount of time that the upward velocity will be applied to the player (that is, the minimum time that the player can jump upward).
 * MaximumJumpTimeout: Same as above, except this unit is the maximum amount ofStotime that the player can jump upward.

Ducking
The player ducks when they press Down while on a flat tile on the ground. The player is unable to use the Left or Right actions to move, and they decelerate according to the tile's surface friction. Super players have their hitbox height halved, allowing them to duck and slide underneath one-tile-high gaps.

Spin Jumping
A spin jump occurs when the user presses the Alt Jump action button. The player will perform a short, spinning jump in midair that adds an offensive and defensive component. The jump itself behaves mostly like normal jumping, except it is typically shorter, with smaller velocities and shorter jump timeouts. The definable properties are the same to normal jumps, except their values (see above).

A spin jump allows the player to more easily destroy certain enemies and bounce atop other enemies that would normally injure on any other kind of contact. The act of bouncing on such an enemy while spin jumping is referred to as stomping. Each stomp is a mini-jump, forcing the player upward, but far less than a jump would. The player may hold Jump or Alt Jump to perform higher stomps off of enemies.

Other definable properties:
 * MinStompImpulse: A unit, measured in pixels per second, that the player's Y velocity is set to after stomping on an enemy without holding Jump or Alt Jump. this value should be very low.
 * MinStompTimeout: A measure of time that the player is moved upward while stomping on an enemy without holding Jump or Alt Jump.
 * MaxStompImpulse: A unit of vertical velocity that the player experiences when stomping on an enemy while holding Jump or Alt Jump.
 * MaxStompTimeout: A measure of time that the player is moved upward while stomping on an enemy without holding Jump or Alt Jump.

Wall Sliding and Wall Jumping
If a player comes into contact with a wall while holding down Left or Right (depending on which side of the player the wall is) and they're not standing on the ground, they will slide down the wall and be able to perform wall jumps. Sliding down a wall reduces gravity's effect on a player by a multiplier. The player will stop sliding if the wall vanishes, moves, or if the player releases the directional action key or presses its opposite.

If the player presses Jump or Alt Jump while sliding down a wall, they will perform a wall jump. A wall jump is a diagonal jump up and away from the wall at a certain angle. Again, like other jumps, a timeout is used to stop the player's upward progress (but not their horizontal speed), but there is only one timeout value used, instead of a minimum and maximum.

A certain hackish method will be used to allow the player to easily wall-jump between two close walls without having to release and press the opposite directional key. For a short period of time after performing a walljump, the player will begin sliding against any wall no matter which directional button the user is pressing, and they can walljump again off of the new wall, so long as they hold either left or right.

Definable properties:
 * Wall sliding velocity multiplier: A value between 0 and 1 that is used to multiply the maximum downward velocity that the player can fall while they are sliding down a wall.
 * Wall jump horizontal impulse: An sideways velocity that is applied when the player walljumps.
 * Wall jump vertical impulse: An upward velocity that is applied when the player walljumps.
 * Wall jump timeout: The amount of time that the player will move upward.

In-Air Mechanics and In-Air Spin
The player has full air control - that is, they can move horizontally while in air with the same control they do on the ground. They may accelerate left or right up to walking speed and can turn and accelerate in the opposite direction at any time. If the player was already at running speed, they maintain that speed until they choose to move in the opposite direction. As long as air friction is zero, the player will continue at that horizontal velocity until they land (thus losing velocity to surface friction), hit a wall, or fall out of the level.

The player may also perform in-air spins which temporarily reduce the power of gravity on them, thus prolonging their fall and their ability to reach farther places. An in-air spin is performed when the user presses Alt Run while the player is in the air and is falling. For the duration of the spin, the player's downward velocity is multiplied by a value less than 1 which reduces their falling speed and prolongs their fall. After a short delay, they can repeat the spin, and they may repeat the spin as long as they are falling.

Should the player's vertical velocity suddenly shift upward (perhaps by stomping an enemy), the in-air spin is immediately canceled.

Definable properties:
 * In-air spin duration: A unit of time, expressed in seconds, that determines how long a mid-air spin lasts and for how long the multiplier is applied.
 * Velocity multiplier: A value, between 0 and 1, that determines by how much the downward velocity of the player is reduced. For instance, a value of 0.2 will reduce the player's downward velocity by 80%.
 * Recharge time: A unit of time, expressed in seconds, that determines how long a player must wait before performing another in-air spin.

Ground Pounding
The player may perform a ground pound - a powerful stomp that crushes most enemies instantly, breaks blocks, and releases the contents of item blocks. A ground pound is performed when the user presses the Down button while the player is in mid-air. The player immediately loses all velocity, performs an animation, and then plunges to earth at a certain velocity. The user can cancel a ground pound by pressing Jump or Alt Jump during it, or merely press nothing to allow the ground pound to finish.

Definable properties:
 * Ground pound velocity: A measure of velocity, expressed in pixels per second, that the player will descend during ground pounds.

Sliding
The player slides when the player is on a sloped tile and the user presses (but doesn't necessarily hold) Down (or lands on a slope while ground-pounding). The player will then begin sliding down the slope in whichever direction the slope descends. Sliding players can kill most enemies that not strictly above the player - otherwise, the player is hurt on contact.

If the player slides off of the end of a slope into the air, the player will continue to fall and slide until they hit ground or fall out of the section. If the player slides onto flat tiles, the player will decelerate according to the default friction. The player can cancel a slide by jumping, spin jumping, or moving.

Swimming
Swimming is the player's mode of transport while they are in water blocks or a water section. Instead of walking, running, and jumping, instead they swim in four directions using the directional buttons and Jump/Alt Jump.

Pressing Left or Right will move the player in that direction. If they are standing on a tile, they will walk very slowly across the top of the surface. If the button is released, the player will quickly come to a stop, as the surface friction is multiplied signficantly. Ice tiles will remain rather slick, but not by much.

If the player is floating in the water, the player will move more quickly when Left or Right is pressed, but will continuously lose height to gravity. Gravity accelerates the player more slowly, but the player may still reach the maximum downward velocity as they do in air.

The player can ascend by pressing Jump or Alt Jump. Holding Down while pressing Jump or Alt Jump will rise them by a tiny fraction of tile, useful to maintain height without swimming upward into hazardous conditions. Holding Up while swimming upward will greatly boost the player's ascent and allows the player to jump out of the water to the normal walking jump height. The player cannot jump out of the water without holding Up, otherwise, they will push up against its surface.

Definable properties:
 * Underwater walking speed: The velocity at which the player walks along a surface while underwater.
 * Underwater surface friction multiplier: A multiplier applied to surface friction while the player is underwater.
 * Underwater gravitational acceleration: The acceleration of gravity while the player is underwater; the rate at which they accelerate while not standing on a tile.
 * Small ascent velocity: The upward velocity the player is given when the user presses Jump or Alt Jump while holding Down.
 * Ascent velocity: The upward velocity the player is given when the user presses Jump or Alt Jump.
 * Large ascent velocity: The upward velocity the player is given when the user presses Jump or Alt Jump while holding Up.

Player Graphics
Players have graphics, composed of a group of named groups of individual frames of graphics. Each named group may consist of one or more frames, and the rate at which they're displayed is directly set by the player's code. Frames are mirrored for left/right versions unless the code specifies otherwise.

The named groups are as follows: This list is not conclusive and the names are not final.
 * Stand (idle).
 * Duck
 * Looking up
 * Walk
 * Run
 * Skid
 * Standing/Walking Jump (includes player's "falling" graphic)
 * Spin Jump
 * Swimming
 * Walking with item
 * Running with item
 * Jumping with item
 * Swimming with item
 * Kicking item
 * Looking up with item
 * Climb (view player's back): This one is animated iff the player is moving, otherwise it's paused.
 * Climb (view player's front): On opposite side of fencing.
 * Riding vehicle
 * Running up a wall

Power-Ups
Power-ups are items that modify the player's appearance and behavior, typically to give the player an advantage in the level, such as the ability to shoot fireballs or to fly. Power-ups additionally increase the player's health.

Super Player
This power-up state occurs when the player contacts a Super Mushroom. It doubles the player's hitbox and increases their health from one hitpoint to two. Physics, handling, and controls remain the same, as well as all behaviors.

Fire Player
This power-up state occurs when the player contacts a Fire Flower. The Fire player is as large as the Super player and has three hitpoints. This player can shoot fireballs using Run or Alt Run in the direction they're facing, and they can shoot fireballs at a higher trajectory by holding Up. They can have up to two of their own fireballs onscreen at once. Their fireballs can kill most enemies and take one hitpoint off of bosses.

Raccoon Player
The player is transformed into this state through the Raccoon Leaf. The player can spin their tail by pressing Run or Alt Run, which breaks brick blocks, triggering item blocks, and kills enemies on the ground next to the player. If the player spin-jumps, the tail spin effect takes place through the entire spin-jump.

Pressing Jump or Spin Jump while in the air will cause the player to float for a second, not dissimilar to an in-air spin. If the player achieves running speed, the player can jump into the air at significant height and then fly for several seconds by pressing Jump or Spin Jump, which gives a slight upward velocity boost.

A P-Meter appears onscreen which shows the player's speed. When the player achieves running speed, the P-Meter is full and begins beeping to indicate that the player can now fly.

Alternately, the player is transformed through a P-Leaf map item, which allows the player to always have a full P-Meter and thus always be able to fly, but jumps aren't very high.

Definable properties:
 * P-Wing: A flag set if the player uses a P-Wing item.
 * Tail Spin Length: The length of time in a tail spin, measured in seconds.
 * Floating Speed Multiplier: Similar to the In-Air Spin's velocity multiplier. Measured between 0 and 1.
 * Floating Length: The length of time that the player floats by pressing Jump or Spin Jump, measured in seconds.
 * Full-Speed Jump Multiplier: How many times a full running jump the player can jump with a full P-Meter.
 * Flight Upward Velocity: The upward velocity that the player is given while flying. This cancels downward velocity. Measured in pixels per second.

Tanooki Player
This power-up is given through the Tanooki Suit and Tanooki players behave mostly like Raccoon Players, except that when they press and hold Alt Run, they turn into a statue which is immune to enemies but cannot move. The statue can also crush enemies that can be killed with a ground pound, plus a few more. The statue reverts back into the player after a short time.

Definable properties:
 * Statue Time: The length of time a statue can remain a statue, measured in seconds.

Hammer Player
This power-up is given through the Hammer Suit. Players can throw hammers through Run or Alt Run, which are projectiles that can kill more kinds of enemies. Hammers have a higher trajectory than fireballs, and the player can throw hammers at an even higher trajectory by holding Up.

Hammers do not collide with the ground or any tiles (except lava, which incinerates them) and are not removed when they hit an enemy; indeed, they can score multiple hits on larger bosses. Only two hammers can be onscreen at once.

The Hammer player cannot slide.

Frog Player
This power-up is given through the Frog Suit. The Frog player hops along the ground in small hops, can't run, duck, spin-jump, in-air spin, or wall jump, but this is balanced by very fast swimming in the cardinal directions.

Definable properties:
 * Hop Velocity: The velocity that the player moves while hopping, achieved instantly when the player moves and lost instantly between hops and when the player stops moving.
 * Hop Timeout: The timeout in seconds between hops.
 * Swim Velocity: The velocity which the player swims.

Cape Player
This power-up is given through the Cape Flower. The Cape player can perform a cape spin by pressing Run or Alt Run, which injures enemies beside the player and triggers item boxes and breaks bricks next to the player's head. If the player spin-jumps, the cape spin effect occurs on the entire way up.

If the player achieves full running speed, they can jump very high into the air and achieve flight.

Cape flight is a complicated system. The user must wait for a short time after achieving maximum jump height and can then press the opposite direction button that they're facing (if the player is facing to the right, the user must press Left), and the player then catches air with their cape, gaining a little height. Flight can only be done while the player is holding Run, otherwise it's terminated immediately.

After another short time-out, the player has to press the same button again to catch more air and gain more height, continuing the flight. If the player presses the button in the player's direction, the player will dive, quickly losing height. When a diving player lands, a POW effect will occur, damaging onscreen sprites and dropping coins on-screen.

The player can reduce their descent speed by holding Jump. If the player presses nothing after achieving full jump height, they'll fall normally to the ground. If the player presses nothing after catching air, the player will descend slowly. If the player hits an enemy or harmful obstacle while flying, the player is not hurt, but flight stops and the player gains mercy invincibility.

The player can switch their direction of flight by pressing Alt Run between catching air - it's toggled between left and right.

Definable properties:
 * Cape Spin Time: The length of time that a cape spin lasts.
 * Jump Height Multiplier: How many times a full running jump the player can jump at full running speed.
 * Flight Timeout: The time the user needs to wait before beginning or continuing flight.
 * Air Catch Time: The time that the player ascends during an air catch.
 * Upward Flight Velocity: The velocity that the player ascends during an air catch.
 * Slow Descent Multiplier: A number between 0 and 1 that is multiplied by the standard descent speed to get the slow descent speed.
 * Dive Velocity: The velocity the player dives at.

Mini Player
This power-up is given through the Mini Mushroom. The player is shrunk to about half the height and width of their small size and have only one hit-point. Their handling and physics is far more floaty and pronounced; mini players jump higher, fall much slower, and can perform in-air spins with less of a timeout. Mini players cannot stomp stompable enemies normally; players instead bounce off of enemies. In order to stomp an enemy, the mini-player must ground-pound the enemy in order to stomp them.

At full running speed, the mini-player can run across the surface of water and even up walls and across ceilings so long as the player stays at speed.

Definable properties:
 * Jump Height Multiplier: How many times higher a Mini Player can jump than a small Player. Scales equally at all speeds.
 * Gravitational Acceleration Multiplier: The multiplier applied to the player's gravitational acceleration - lower multipliers mean that the player accelerates to full falling speed slowly.
 * Maximum Gravitational Velocity Multiplier: The multiplier applied to the player's maximum downward velocity - lower multipliers means that the player falls more slowly.
 * In-Air Spin Timeout: The time in seconds before a Mini Player can perform an In-Air Spin after performing the last one.

Bee Player
This power-up is given through the Bee Mushroom. The player can fly for a short period by holding Jump after jumping. The remaining flight time is displayed in a small gauge that appears next to the player. The player can recharge this gauge slightly by collecting coins. If the player collects a coin which awards multiple coins (such as the 10 Coin), the flight gauge is restored by as much as if the player had collected those coins individually.

After the Bee Player exhausts the gauge, provided they don't collect any coins on the way down, they will slowly hover to the ground. The flight gauge is also fully recharged over a short period of time by landing on the ground or catching a vine or net. If the player leaves the ground before the gauge is fully recharged, their total flight time is reduced accordingly.

The Bee Player cannot spin-jump, perform in-air spins, or ground-pound. The Bee Player will not only lose the suit if hurt but will also lose it on contact with water.

Definable properties:
 * Flight Velocity: The velocity at which the player flies. This is split up over the player's velocity by their direction - a player going upward will direct all velocity vertically. a player flying sideways will direct all velocity horizontally, etc.
 * Flight Time: The time in seconds that a player can fly without collecting coins.
 * Coin Recharge Amount: How much of the flight gauge is restored by collecting a single coin, expressed as a number between 0 and 1.
 * Hover Velocity Multiplier: The multiplier applied to the player's maximum downward velocity when their flight gauge is emptied.
 * Flight Recharge Time: The time in seconds that it takes to fully restore an empty flight gauge to maximum.

Frozen Player
This power-up is given through the Frozen Flower (renamed to avoid confusion with the Ice Flower). For 20 seconds or until hurt (at the decision of the level designer), the player can create ice tiles on the surface of water, allowing them to walk and run across the surface of water. Any enemies floating within that top tile are destroyed. If the player contacts water from the side, ice tiles will be created on the side. A player who takes a Frozen Flower while underwater will very quickly rise out of the water, creating a trail of ice tiles - if there is no surface of the water in the level, the player dies by crushing.

Definable properties:
 * Power-up length: The time in seconds that a player remains in the Frozen state.

Propeller Player
This power-up is given through the Propeller Mushroom. The player can propel upwards to a great height while on the ground or in the air, allowing them to clear enormous gaps and jump massive heights easily.

After propelling to full height, the player will, by default, flutter to the ground, sinking slowly with a moderate amount of horizontal air control. If the user holds the spin button, the player will spin rapidly and gain a bit more air control. If the user holds down while spinning or fluttering, they will do a drill, which is equivalent to a slower ground pound.

Definable properties:
 * Propeller Time: The time in seconds that the player ascends while propelling.
 * Propeller Velocity: The velocity at which the player ascends while propelling.
 * Fluttering Velocity: The velocity at which the player descends while fluttering or spinning.
 * Fluttering Air Control Multiplier: The multiplier applied to the maximum velocity AND acceleration applied to the player's horizontal motion while fluttering.
 * Spinning Air Control Multiplier: The multiplier applied to the maximum velocity AND acceleration applied to the player's horizontal motion while spinning.
 * Drill Velocity Multiplier: The multiplier applied to the maximum ground-pound velocity.