Iâ€™m working on adding jumping and platforms, to my top down action game, to give it a sense of depth.
The game will look a bit like 2D Zelda. It's multiplayer - here's a demo: http://www.badmiracle.com/hero/ (player graphics are not my own)
Screenshot Example for Context: https://www.dropbox.com/s/lcfd5mfvdiv2e ... n.png?dl=0
Iâ€™m having some trouble getting jumping to work, and I canâ€™t seem to figure it out. Iâ€™ve created a â€œzâ€ axis for depth, and played around with adding a jumping power variable that will increment the players Z with delta time, and another variable for jump height... but it eventually becomes so convoluted that I end up back at square one. Itâ€™s a lot more complex then I thought.
Iâ€™ve implemented a collision system that R0J0hound created so that I could have some form of depth based collision control. It works quite well for making sure you only collide with objects on the same â€œzâ€ height as your character.
I have a stripped down capx containing a player that can be controlled and a bunch of stacked boxes. Iâ€™m hoping someone can either direct me on how to do it, or create such a system that will explain it.
Capx Example: https://www.dropbox.com/s/pckfuj4ajot1x ... .capx?dl=0
Thanks in advance for any help/advice... (or even words of encouragement at this point) that you can provide!
Develop games in your browser. Powerful, performant & highly capable.
Here is a basic bare bones example of how to implement and keep track of a "vertical position" value as data only (my numbers are represented by m/s for a natural feel, but you can use whatever unit you want to fit into your system).
https://www.dropbox.com/s/ib8cmxhk1zk30 ... .capx?dl=0
The hard part is the collision filtering (custom solids behavior) system that can interact based on an objects "vertical position". This I can't really help much with, but it looks like you've got something to work with there already.
Edit: Also event 5 is what stops gravity from acting and (when Zheight is 0, or "at rest" on the floor). You may need to add some events to account for "resting" on different levels, such as on top of a box. Your Z height will be greater than 0, but it should not be accelerated by Zspeed and Gravity anymore.