I'll try this again as everything else is pretty much fixed. I have slope collisions mostly working and can blast through at any speed without tunneling through. And you can jump in an arc based on the slope normal if you're not moving very fast.
So now the final problem is jumping while trying to move up-hill. That is I want to be able to jump up (vertically) from the slope while moving uphill. See the horizontal collision functions will detect a slope and actually bump you up to the y position of the slope (which is a height map). Which means it will stick to the floor and never get a jump.
This is only part of the problem. The second part of the problem is that the jump is based on the slope normal which I have hard coded into the tiles and then I read them and put it in a member called jumpDir. The steeper the slope, the shallower the normal.
Okay so if I comment out the lines where it sets the y position based on a horizontal collision then it simply jumps through the slope. The third part of the problem is gravity constantly drags the sprite down -- so what you have is a sprite that can't jump very high on slopes when moving up-hill.
I'm not really sure what to do, but if all else fails I'm going to increase the jump force depending on the slope so it will at least clear the slope tiles in a move.
Here's a video showing the problem, make note of the first 4 seconds, in which I'm trying to jump but can't:
And here's the love file -
Hopefully someone can give me an idea... of course I suppose most of you wouldn't care to wade through someone else's code, and admittedly, my code is a bit stranger than most, but I don't think my code is entirely unreadable. Most of the code is in player.lua -- so look there first.
Thanks
Can someone help me fix my last "slope" related problem?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Can someone help me fix my last "slope" related problem?
Last edited by Uhfgood on Thu Jan 10, 2013 7:02 am, edited 1 time in total.
Keith Weatherby II / twitter / facebook / youtube
IndieFlux - Reviews and more! / Games Afoot Software
IndieFlux - Reviews and more! / Games Afoot Software
Re: Can someone help me fix my last "slope" related problem?
I had a quick look at your code. Can you explain one thing to me? Maybe that helps me helping you:
When the player is moving around you keep updating the jumpDirection, which is a vector that tells us, what direction the player jumps to. Then I press jump, a velocity vector in this direction is added to the player's velocity. As far as I see, this is done in the update() function and not only in the single moment, when the key is pressed. Is that correct or am I wrong here?
And one small comment: Making the jump orthogonal to the sloped ground seems physically plausible, but I doubt it will be fun for the player. I highly suggest, you implement a straight jump in y-direction.
And last: Nice and fluid framework so far. It is a lot of fun, just running around on the platforms and slopes. Keep up good work!
When the player is moving around you keep updating the jumpDirection, which is a vector that tells us, what direction the player jumps to. Then I press jump, a velocity vector in this direction is added to the player's velocity. As far as I see, this is done in the update() function and not only in the single moment, when the key is pressed. Is that correct or am I wrong here?
And one small comment: Making the jump orthogonal to the sloped ground seems physically plausible, but I doubt it will be fun for the player. I highly suggest, you implement a straight jump in y-direction.
And last: Nice and fluid framework so far. It is a lot of fun, just running around on the platforms and slopes. Keep up good work!
Check out my blog on gamedev
Re: Can someone help me fix my last "slope" related problem?
When I run the .love it starts fading to grey, after about 2 seconds it's all grey and I can't see anything.
P.S: r, g, b, and a returned by lg.getColor() decrease a little each frame. I added the following code to create a log file showing frame number, microtime and rgba, I'm attaching the strange result.
P.S: r, g, b, and a returned by lg.getColor() decrease a little each frame. I added the following code to create a log file showing frame number, microtime and rgba, I'm attaching the strange result.
Code: Select all
local r, g, b, a = love.graphics.getColor();--your code
local tNix = love.timer.getMicroTime()
fNix:open('a')
fNix:write('\n', tNix, ': ', r,' ', g, ' ', b, ' ', a, ' frame: ', iNix)
fNix:close()
love.graphics.setColor(176, 176, 176, 255);--your code
love.graphics.rectangle("fill", 0, 0, 320, 180);
love.graphics.setColor(r, g, b, a);
- Attachments
-
- log.log
- (548.47 KiB) Downloaded 67 times
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Can someone help me fix my last "slope" related problem?
mmh, maybe the same problem than viewtopic.php?f=4&t=12261Nixola wrote:When I run the .love it starts fading to grey, after about 2 seconds it's all grey and I can't see anything.
no problem for me on this PC (ubuntu 12.10, GeForce Go 7400)
Current work : Isömap
Re: Can someone help me fix my last "slope" related problem?
Thanks, I wrote my OS and graphic card there
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Can someone help me fix my last "slope" related problem?
A quick note on the color thing, someone was telling me it happened to them when they ran the 64-bit version of love, but when they ran the 32 bit version it worked fine.
I had set the gray background color so I could see a few things better (at least a couple of months ago).
I had set the gray background color so I could see a few things better (at least a couple of months ago).
Keith Weatherby II / twitter / facebook / youtube
IndieFlux - Reviews and more! / Games Afoot Software
IndieFlux - Reviews and more! / Games Afoot Software
Re: Can someone help me fix my last "slope" related problem?
tested with 64 bits architecture and no problem deceledUhfgood wrote:A quick note on the color thing, someone was telling me it happened to them when they ran the 64-bit version of love, but when they ran the 32 bit version it worked fine.
it's just a quick idea but is the problem maybe related to LuaJIT version of love ?
Current work : Isömap
Re: Can someone help me fix my last "slope" related problem?
The jumping does work this way, but the jump velocity should be 0 when you're not jumping which means hopefully nothing extra gets added when you're not jumping.
As far as your comment goes, Sonic the Hedgehog (the original Genesis/MegaDrive ones) works like this. He'll jump perpendicular to the slope. Though going uphill works a bit differently, which is what I'm trying to fix in my code. Essentially when Sonic jumps uphill his x (horizontal) movement slows down a bit but he still manages to jump upward (I'm not really sure how this works out), but it allows him to clear the hill to a certain extent.
As far as your comment goes, Sonic the Hedgehog (the original Genesis/MegaDrive ones) works like this. He'll jump perpendicular to the slope. Though going uphill works a bit differently, which is what I'm trying to fix in my code. Essentially when Sonic jumps uphill his x (horizontal) movement slows down a bit but he still manages to jump upward (I'm not really sure how this works out), but it allows him to clear the hill to a certain extent.
Saegor - no idea, I just use the thing, I don't know about the internals. It has been working just fine for me so I don't know what's causing the problem.micha wrote:I had a quick look at your code. Can you explain one thing to me? Maybe that helps me helping you:
When the player is moving around you keep updating the jumpDirection, which is a vector that tells us, what direction the player jumps to. Then I press jump, a velocity vector in this direction is added to the player's velocity. As far as I see, this is done in the update() function and not only in the single moment, when the key is pressed. Is that correct or am I wrong here?
And one small comment: Making the jump orthogonal to the sloped ground seems physically plausible, but I doubt it will be fun for the player. I highly suggest, you implement a straight jump in y-direction.
And last: Nice and fluid framework so far. It is a lot of fun, just running around on the platforms and slopes. Keep up good work!
Keith Weatherby II / twitter / facebook / youtube
IndieFlux - Reviews and more! / Games Afoot Software
IndieFlux - Reviews and more! / Games Afoot Software
Re: Can someone help me fix my last "slope" related problem?
for your jump problem, you may find some inspiration with Open Sonic or even Open Surge, two sonic-like clones that i love a lot (but you have to know C to understand the code)
Current work : Isömap
Re: Can someone help me fix my last "slope" related problem?
While I understand C, I looked at some of the source for open sonic, and it's hard to decipher for me.
Keith Weatherby II / twitter / facebook / youtube
IndieFlux - Reviews and more! / Games Afoot Software
IndieFlux - Reviews and more! / Games Afoot Software
Who is online
Users browsing this forum: Google [Bot] and 207 guests