physics problems

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Arthurio
Prole
Posts: 8
Joined: Sun Jul 12, 2009 7:12 pm

physics problems

Post by Arthurio » Tue Jul 28, 2009 10:27 pm

Check the attachment. Sorry bout the messy code, I'm just testing stuff. The included graphics are placeholders, found on the web.

move: w, a, s, d
run: shift + a or w
jump: space
toggle debug stuff: h

My problem is the following: I want to check if the character should be able to jump or not but the collision seems to fluctuate, even when the character is just standing still.

Maybe I'm doing something wrong, or maybe it's supposed to be like that you tell me.

It works like this:

1) "collision" function adds the collision to a table
2) "update" function does nothing with the collisions atm
3) "draw" function draws the collision point, info and graph
4) "draw" function clears the collisions table

So should I check if the last (valid) collision was less than 3 frames ago and let the character jump?

The scrolling graph represents log of how many frames ago the last collision occured. So ideally if the character is standing in one place, walking or even running the line should be flat. When he jumps there should be a spike.

2. problem: when I move the game window the character jumps. (other objects too if there are more) Why? Is there a solution/workaround?

edit: ok like 10 seconds after I post, I found something interesting...
when I change this line:
world.update(world, dt*10)
to:
world.update(world, dt*20)
the fluctuations cease. why? and is that the correct solution?
Attachments
platf.love
dt*20
(294.88 KiB) Downloaded 134 times
platf.love
(294.88 KiB) Downloaded 127 times

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests