Okay, I finally have some time to get this done (2.5D platform plugin, for RPGs, brawlers and whatnot).
EDIT: The latest demo will always be at http://octavoarte.cl/25d_concept.exe while I'm working on this.
Since this time is limited to about a month TOTAL, I figure I'd better throw ideas and get feedback right before even starting.
My first idea would work something like this:
- Everything (with the behavior) is a cylindrical platform with a sloped top. This means players could stand on top of each other if desired.
- The top has the same profile as the base (regardless of slope) and profile needs to be specified separately (Feedback here: separate objects? frames? collision mask?).
- Everything on top of something stays there unless moved, regardless of slope.
I've settled on the following attributes:
- W=faux height
- RY=real y.
- RX=real x.
- DyDt=real y speed.
- DxDt=real x speed.
- DwDt=w speed.
- DwDx=top slope on real x
- DwDy=top slope on real y
- T=W Climbing Threshold, for stairs and such.
- WY= offset on Y for each unit of W
- WX= offset on X for each unit of W
- Ignore collision= toggles whether the object will react to collision or its absence.
- Player= sets the player that controls this object.
- Unmovable= toggles whether the object is controlled by a player (Feedback: is this needed?)
Collision would be as follows:
IF platform profiles collide at equal W AND platforms sprite collide, THEN platforms are colliding.
Movement would be as follows:
- Y=RY+(WY*W)
- X=RX+(WX*W)
- Falling modifies W only.
- Sprites are sorted according to RY and its sign.
- On collision, an object is placed on top of another object only if doing so doesn't move the object more than T. Otherwise it gets pushed out in the angle of its speed. If speed is 0, nothing happens. Height is determined by measuring the distance between the profile aligned at the bottom and at the top of the sprite.
Expressions would be as follows:
- Is above
- Is below
- Is falling
- is on top of
- get (any) attribute
Actions would be as follows:
- Set position to (real x, real y,w)
- get/set attributes
So far the only undecided issues are:
- Profile storage. Where to store the profile image for a platform?
- Are slopes necessary? They could bring issues in the math for movement.
- Controls by multiple players. I don't know how this works. Is a separate toggle needed for objects that are not player-controlled?
Feedback and implementation tips are very welcome! This will be my first plugin, only done fx so far.