I've been tinkering this, and I'm struggling to work out how one would add friction into the engine.
Obviously, it would have to be framerate-independent, and so far, I can't seem to get a reliable consistent speed.
Anyone more math-oriented than me want to help?
Platformer game engine (a proper one, really!)
Re: Platformer game engine (a proper one, really!)
If you want to have anything framerate independent you are going to need to use the delta time (the dt in "love.update(dt)"). That will tell you the time between frames.
Re: Platformer game engine (a proper one, really!)
How do I use this engine, like source? I tried downloading that and opening the .love in notepad++ and get a string of odd/weird character
Re: Platformer game engine (a proper one, really!)
.love sources are actually zipped folders. Rename it to .zip and unzip it to get the folder with the file sources. More info herejspham wrote:How do I use this engine, like source? I tried downloading that and opening the .love in notepad++ and get a string of odd/weird character
https://love2d.org/wiki/Game_Distribution
Re: Platformer game engine (a proper one, really!)
That's great and all, but friction doesn't work that way.Lap wrote:If you want to have anything framerate independent you are going to need to use the delta time (the dt in "love.update(dt)"). That will tell you the time between frames.
Re: Platformer game engine (a proper one, really!)
How does it work then?Ruirize wrote:That's great and all, but friction doesn't work that way.Lap wrote:If you want to have anything framerate independent you are going to need to use the delta time (the dt in "love.update(dt)"). That will tell you the time between frames.
Re: Platformer game engine (a proper one, really!)
Hey friend. Sorry to necro-post, but I couldn't find an answer to this and I thought this bore addressing: there is a crash in the "doors" map that seems to occur when the player is in a spot where the door will land or between the door and the spot it will land, but not if the player is very close to (like within a few pixels) or touching the door. Further testing revealed that the game crashed with the same error in "Islands" if I fall, and if I actually try to exit "Doors" via the door at the end. The error is as follows:
Since no one has posted anything like this in the thread, I am guessing this has to do with a more recent update of the attachment of OP?
Code: Select all
Error
block.lua:31: attempt to call field 'drawq' (a nil value)
Traceback
block.lua:31: in function 'draw'
player.lua:140: in function 'event' --doesn't have this line on level-exit crash
level.lua:198: in function 'draw'
main.lua:79: in function 'draw'
[C]: in function 'xpcall'
Re: Platformer game engine (a proper one, really!)
The code seems to crash because it is written for an older version of LÖVE.
The function "drawq" was only available in older versions of LÖVE, I think up to 0.8. In the current verions 0.9.2 it has been removed and replaced by draw.
The function "drawq" was only available in older versions of LÖVE, I think up to 0.8. In the current verions 0.9.2 it has been removed and replaced by draw.
Check out my blog on gamedev
- NightKawata
- Party member
- Posts: 294
- Joined: Tue Jan 01, 2013 9:18 pm
- Location: Cyberspace, Room 6502
- Contact:
Re: Platformer game engine (a proper one, really!)
Micha's post does explain it fully, and it is because this engine was written for 0.8.0.Sarcose wrote:Hey friend. Sorry to necro-post, but I couldn't find an answer to this and I thought this bore addressing: there is a crash in the "doors" map that seems to occur when the player is in a spot where the door will land or between the door and the spot it will land, but not if the player is very close to (like within a few pixels) or touching the door. Further testing revealed that the game crashed with the same error in "Islands" if I fall, and if I actually try to exit "Doors" via the door at the end. The error is as follows:
Since no one has posted anything like this in the thread, I am guessing this has to do with a more recent update of the attachment of OP?Code: Select all
Error block.lua:31: attempt to call field 'drawq' (a nil value) Traceback block.lua:31: in function 'draw' player.lua:140: in function 'event' --doesn't have this line on level-exit crash level.lua:198: in function 'draw' main.lua:79: in function 'draw' [C]: in function 'xpcall'
Welcome to the forums, by the way!
I will give you one big tidbit of advice: In 3 years time, things made with LÖVE are probably going to be a bit broken. With every big release (0.7.2 -> 0.8.0, 0.8.0 -> 0.9.0), they're generally not backwards compatible.
If you want a good library and some pretty good documentation to build a platformer with, try this out!
"I view Python for game usage about the same as going fishing with a stick of dynamite. It will do the job but it's big, noisy, you'll probably get soaking wet and you've still got to get the damn fish out of the water." -taylor
Re: Platformer game engine (a proper one, really!)
Hey thanks a lot for the help. Since I wrote that post and have been digging around a lot more/working on my code, I found someone post a tidbit of code that enables drawq compatibility with newer versions of LOVE:
This was posted by HugoBDesigner in Small Useful Functions, and it's been invaluable. Might I just remark on how awesome Love2d and Lua are, that I was able to see this function and instantly know what to do with it to make it work in an already packaged game?
Thanks for the welcome. I'm definitely going to check out your link.
Code: Select all
love.graphics.rdraw = love.graphics.draw
love.graphics.drawq = love.graphics.drawq or love.graphics.rdraw
function love.graphics.draw( ... )
local args = { ... }
if type(args[2]) == "userdata" then
love.graphics.drawq(unpack(args))
else
love.graphics.rdraw(unpack(args))
end
end
Thanks for the welcome. I'm definitely going to check out your link.
Who is online
Users browsing this forum: No registered users and 2 guests