[Unsolved]Hardon Collider Problem

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
SerTrollface
Prole
Posts: 3
Joined: Tue Mar 12, 2013 8:12 pm

[Unsolved]Hardon Collider Problem

Post by SerTrollface »

I'm using Hardon Collider to make a platform game, and i have a problem. The "ground" (a green rectangle until i solve this problem) isn't solid, i made a -theorically- working on_collide function, but the player (that for some other reason doesn't use the image it should use) passes right trough it. Also, the camera doesn't follow the player.
Before asking why the rectangle is 6000px wide,it is because i wanted to test also the camera.
In the .rar (not .love, for editing it's better the zipped one I think) you'll find some main-.lua, mainOld.lua etc. They're tutorial/old files i use only to copy-paste or to look the old scripts.
EDIT : Partially solved the animation problem, I changed to anim8. But still, even if the player X pos and Y pos update correctly on the debug informations, the image and the player state(variable to decide which image has to be used) don't. The image falls but it doesn't move horizontally, and the player state is still at "falling" .
Please help.
Attachments
PlatformTest.rar
Zipped game folder (not .love)
(83.88 KiB) Downloaded 68 times
Last edited by SerTrollface on Sun Mar 17, 2013 1:36 pm, edited 2 times in total.
SerTrollface
Prole
Posts: 3
Joined: Tue Mar 12, 2013 8:12 pm

Re: [Hardon collider]Hardon Collider Problem

Post by SerTrollface »

Sorry for the double post, but I really need help.
User avatar
Hexenhammer
Party member
Posts: 175
Joined: Sun Feb 17, 2013 8:19 am

Re: [Unsolved]Hardon Collider Problem

Post by Hexenhammer »

But still, even if the player X pos and Y pos update correctly on the debug informations, the image and the player state(variable to decide which image has to be used) don't.

Code: Select all

    -- update the player's state
    player.state = Player.getState()

Code: Select all

-- returns shape's state as a string
function Player.getState()
   -- if player.index == not 'player' then return end
    local myState = ""
    if player.ySpeed == 0 then
        if player.xSpeed > 0 then
            myState = "moveRight"
        elseif player.xSpeed < 0 then
            myState = "moveLeft"
        else
            myState = "stand"
        end
    end
    if player.ySpeed < 0 then
        myState = "jump"
    elseif player.ySpeed > 0 then
        myState = "fall"
    end
    return myState
end
Looks like the player's state won't switch from "fall" to "stand" unless player.ySpeed is exactly 0. I don't have time trying to understand your code but I put "error(player.ySpeed)" at the top of the getState() function and the output was a floating point value...

Comparing floating point values for equality is tricky to say at least. My guess is that when your player stops on the ground his ySpeed is not actually exactly 0 but some floating point value close to zero.
Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 1 guest