I'm just curious how would you do something like that?
https://twitter.com/LorenSchmidt/status ... 4802542592
I think it would be easy to do it on a plane but with stairs? Would you use different types of stairs and then check for them or would you use pixel perfect collision?
Procedural animation?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Procedural animation?
Get the horizontal (x) position of the player, get the horizontal offsets for the feet, then color the topmost pixels of the ground (any type, stairs, whatever) below the player's lowest y coords where those horizontal x + offset positions are... would be one way.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Procedural animation?
As long as all of your stairs have the same slope you could probably get away by using two separate animations: going up and going down. Once you have these two animations, the problem could be simplified to: which frame do you draw, depending on the player's position on stairs. This is the sensible solution.
If you want to support ANY type of slope in your stairs, then we're talking inverse kinematics and other physics nightmares.
If you want to support ANY type of slope in your stairs, then we're talking inverse kinematics and other physics nightmares.
Re: Procedural animation?
Well i don't quite get that.
The way I would do it:
Have a pixel perfect collision system that checks beneath the body if its a flat plane or stairs. If its a flat plane it determines the step points and draws two lines from the lower body to these points. If the body moves only the endpoints of the lines are changed to the new ones.
It there is a stair coming check for stair height locate step points and move the "feet" (lines endpoints) there if the body moves over them.
Does this make sense?
But how is pixel perfect collision done in love2d? Or how would you check for collisions in this case. Assuming that a plane can be just a rectangle drawn by love.graphics.rectangle and the stairs could also consist out of small rectangles by love.graphics. Or .pngs for both.
The way I would do it:
Have a pixel perfect collision system that checks beneath the body if its a flat plane or stairs. If its a flat plane it determines the step points and draws two lines from the lower body to these points. If the body moves only the endpoints of the lines are changed to the new ones.
It there is a stair coming check for stair height locate step points and move the "feet" (lines endpoints) there if the body moves over them.
Does this make sense?
But how is pixel perfect collision done in love2d? Or how would you check for collisions in this case. Assuming that a plane can be just a rectangle drawn by love.graphics.rectangle and the stairs could also consist out of small rectangles by love.graphics. Or .pngs for both.
-
- Citizen
- Posts: 52
- Joined: Wed Dec 23, 2015 4:03 pm
Re: Procedural animation?
Why not marking each tile with a "lightable" with white pixels. Then, when your paint the tiles you check if they are near the player. If yes, you fill the white pixels region with magenta/purple/whatever... otherwise in black.
No need for collision detection, just to measure the (linear) distance.
No need for collision detection, just to measure the (linear) distance.
Re: Procedural animation?
If I might have a go... If I am standing at tile 19, do an array check of the tile that is next in the direction faced.
Is its height higher, lower or same as current tile? Draw player image appropriately.
If overhanging a lower tile (stair going down), then the answer is lower. Determining that overhang could then be done a few different ways.
Is its height higher, lower or same as current tile? Draw player image appropriately.
If overhanging a lower tile (stair going down), then the answer is lower. Determining that overhang could then be done a few different ways.
Twitter: @notdamountie
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 0 guests