VRushLP / RigorMortisGame

A game made for TCSS491 Computational Worlds, Winter 2016
2 stars 0 forks source link

Multiframe animation #41

Closed tjsg1992 closed 8 years ago

tjsg1992 commented 8 years ago

There are still a few problems to address with moving platforms: 1. The player does not move horizontally with them (so they have to run to keep up while on top) 2. The player "falls" if standing on a platform that is moving downwards 3. Due to problem 2, if the player moves off of a "falling" platform, they will have accumulated a lot of velocity and fall quickly.

These are all due to there essentially being no way to "magnet" an entity to another entity. However, incorporating that is going to take some thinking, and this branch otherwise accomplishes what I originally set out to do.

The above issues have all been fixed!

tjsg1992 commented 8 years ago

Oh, and to elaborate on what was added: animation.js was altered to accept multiframes. Multiframes are essentially several individual frames that have been stitched together to create one atomic animation frame. So if you want to create, say, a platform that is four forest blocks, you can create a single animation that is three forest blocks combined. Then you update the entities width and height accordingly, and boom, variable-length platforms.

platform.js was created mostly to streamline the above process, and also allow the creation of moving platforms. After creating a platform, you can attach to it a movement pattern. As such, you can tell how far a platform should move (horizontally, vertically, or both), along with how fast. You can also attach multiple movement patterns to a platform (so that it will move back and forth, or in a square outline, or along a long path, etc.). By default, a platform will loop through its movement patterns, but you can always set that to false so that it will stop moving upon reaching a destination.

Finally, gameengine.js was updated so that a platform will move any controllable entities if it collides with them. This is a hacky fix, and we should later add movement priority levels to take care of this (so that platforms can move enemies, etc.)