-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Features Experiments for Enhancements #136
Comments
Lot of awesome stuff here! I know depth sorting has been asked for a few times (#94). I'll take an in depth look at the code over the holiday break. |
Awesome. Let me know if something is not clear and I'll try to explain my implementation a bit better. |
Thanks for this. Yes, this is awesome and it covers a lot of game features. Would you by any chance know how to add or implement a tile based movement for this experiment or as new feature? |
It should be straight forward to translate their grid movement controller ( https://github.com/HaxeFlixel/flixel-demos/blob/master/Input/GridMovement/source/Player.hx ) to Kontra, and put it in place of the current controller code. I can try to do it when I have some time next week, unless you beat me to it. |
Thanks. Can the directional collider code be also applied on moving objects like entity on entity? Ideally I was hoping that the grid based movement will include NPCs and without overlapping the entities or stop on collision as I mentioned. |
The current implementation only allows collisions with a tile layer, but it shouldn't be too hard to make it work with other objects. I'm adding this to my todo list. |
Thanks @andre-lima. I am also hoping for a javascript version that I can edit and not using or scrambled by tsc. Any tips on how to do/convert this with your |
To update to JS, remove all protected/public/private variable declarations and put them in the classes constructor.
becomes:
Whenever you see a type marking, remove it. Then rename your files to .js and that should be enough. If you get some errors, check the console and debug and let us know what worked so the next guy can check it out too. |
I have not tried it yet, but thank you for this! |
@wini3d I just pushed to master the implementation for the grid movement. Check the Here's the link again. Use WASD to move the yellow square. |
@andre-lima This is awesome and smooth!
I see that, but it is a great step! It would be a great addition to the engine once these issues are fixed. I would assume the grid base system has its own simple collision checking and just check only 4 directions which only depends on where the next player or entity move is. btw, I didn't notice any issue with the controls, so curious what is the problem with the Controller interface. |
earlier I stumbled upon this pseudocode related to collision checking between moving objects and also static entities. just thought this might be useful or as reference. |
Alright, so I've had some time to look over this and here are my thoughts:
|
The ray is defined by 2 points that could be represented as Kontra Vectors, but aren't right now. I'm currently starting a simple rpg with Kontra, and I'll start bringing everything I need from the Experiments project to the new one. While doing this, i'll do some refactoring. |
I just added direction and length to Vector for v7. |
Nice. Lot's of new features coming in v7 apparently. Would we also get TS typings with it? |
Hey @andre-lima any updates on the grid movement controller and collider? |
Nope. Sorry, but I won't have the time to work on it for a while. |
I'm working on some new features for Kontra and I'd like to put them here for discussion.
They currently solve some issues I have and I guess they could become plugins or modules in the future. We'd just need to figure out how to make them more flexible.
You guys can see a running demo here:
https://kontra-experiments.netlify.com/
And the repo is here:
https://github.com/andre-lima/kontra-experiments
Here are the experimental features developed.
Depth Sort
You can add objects to a depth sort list, and it'll take care of rendering them in order, based on a parameter.
By default, we sort by the y value. If the object is closer to the bottom of the screen, it's rendered on top of the others.
Collision Mapping
It'll get the tiles data, rows, width and height parameters and put it in an object to be used for the Raycasting feature.
Raycasting
To check if the one object has a direct line of view to another point, we can use the Ray class to cast a ray and check if it hits the collision map or a sprite. If it doesn't, we know the 2 points have a direct line.
Directional Collider
Based on an e-mail exchange with our lord and savior @straker, I created a way to check from which side a collision occurred.
Since I check this by having a "thin" sensor object stuck to each side of the object, I had issues where the object would enter a little bit inside the wall, making 3 of the sensors touch the wall at the same time.
The size parameter is used to avoid the object being stuck in a wall. By testing, I found that if the size value is the same as the speed the object is moving, we don't have this issue.
Helper functions
Used to configure the canvas and do some vector math.
Log Dashboard (WIP)
A way to log quickly changing values without freezing your browser.
The text was updated successfully, but these errors were encountered: