progressive system for platformer game not working

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
User avatar
freeve4h
Citizen
Posts: 56
Joined: Sat Apr 30, 2022 9:48 pm
Contact:

progressive system for platformer game not working

Post by freeve4h »

i am making a platformer game, i programmed in a system so that the direction the player progresses with changes depending on what screen it is (i have no idea how to explain what im trying to make)

however, the progression system is not working, but it is less confusing than the fact that when i comment out the code it still runs the way it did before.

the .love file is
thegame.love
(1.73 MiB) Downloaded 103 times
the function that holds the progressive system it in Player.lua and is commented out (

Code: Select all

Player:bounds()
), try to find it

i have tried looking at the

Code: Select all

require()
, looking through all my code to find a function that may be preventing it to work, searching through all my code to see if the exact same function it somewhere else. the only other thing that may be causing this that i can think of is my potato pc with only 900MB RAM
User avatar
marclurr
Party member
Posts: 111
Joined: Fri Apr 22, 2022 9:25 am

Re: progressive system for platformer game not working

Post by marclurr »

The first thing I noticed is you have defined Player:bounds() twice, once in main.lua and once in Player.lua. I commented out the implementation in main.lua.

Then inside your commented code you have this block:

Code: Select all

   -- level stuff
    if Level < 10 and Level ~= 10 then 
        Player.boundDirection = "up"
    elseif Level == 10 then 
        print("special")
        Player.boundDirection = "special"
        Player:bottomBlock(2, -1)
        Player:topBlock()
        Player:rightBlock(2, 1)
        Player:leftBlock()
    elseif Level > 10 and Level ~= 10 then 
        print("right")
        Player.boundDirection = "right"
    end
When you get to level 10 the boundDirection is set to "special", but you have no code to handle that. I changed it to this:

Code: Select all

    -- level stuff
    if Level < 10 then 
        Player.boundDirection = "up"
    elseif Level >= 10 then 
        Player.boundDirection = "right"
    end
And when you get to the level with the right facing arrow the player can move to the right (indefinitely it seems). Personally I wouldn't set this inside the player its self. In Platform_loader.lua you're setting all the positions of the objects for each level, I would also put the bound direction in there, since it's tied to the level anyway.
User avatar
freeve4h
Citizen
Posts: 56
Joined: Sat Apr 30, 2022 9:48 pm
Contact:

Re: progressive system for platformer game not working

Post by freeve4h »

marclurr wrote: Thu Jul 21, 2022 8:11 am When you get to level 10 the boundDirection is set to "special", but you have no code to handle that. I changed it to this:
"special" means that it is not going one way:
pixil-frame-0 (3).png
pixil-frame-0 (3).png (13.59 KiB) Viewed 1936 times
it was meant so that i could change it any way i like

thanks for pointing out the fact that i defined it twice, that solved the problem
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 4 guests