PRJ-Motion:MechanicsAndFlow

From Digibase Knowledge Base
Revision as of 21:32, 5 December 2013 by C (talk | contribs) (Created page with "==Motion: Mechanics and Flow== This is a poorly written up page on the mechanics and flow of Motion. This is written for later use when C is in a better position to properly e...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Motion: Mechanics and Flow

This is a poorly written up page on the mechanics and flow of Motion. This is written for later use when C is in a better position to properly exercise his theories. All of this applies to the player objects in the game.

Collision

Collision in Motion is detected on a tile by tile basis. The game flow checks the tiles, not the pixels, that the player's hitbox has collided with. Typical collision with a tile from the sides- that is, the tiles left and right sides- reduces player's horizontal velocity to zero so that the player doesn't go through the tile on either side.

Similarly, the tile's collision is checked from the top and bottoms and sets the player's vertical velocity to zero so that gravity doesn't push them through the ground, or so that the player doesn't jump up through the ceiling.

Walking and Running

Self explanatory, for the most part. A global variable determines the player's movement speed for when they press the left and right buttons. But this can actually be implemented two ways:

Double Tap Run "Double Tap" Run is the sort of run mechanic seen in the Kirby series or in Super Smash Brothers. Basically, you double tap a direction to run.

A bool for running is set up. When the bool for running is set false, the player moves with their globally defined walking speed variable. When true, the player moves with the defined running speed variable.

A timer is set up during the initial movement button press. If the button is pressed again during that timer and held, a bool for running is set true, then the player moves with the run velocity instead of the walk velocity. The running bool remains true as long as the button is pressed and held.

Hold Button Run "Hold Button" Run is seen in most 2d platformers, like Donkey Kong Country and Super Mario Brothers. Of the two, it is easier to implement because it simply adds a check for what button is pressed

Jumping

Wall Jumps