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 .
Crono
Prole
Posts: 5 Joined: Mon May 09, 2016 4:35 am
Post
by Crono » Sat May 28, 2016 1:51 am
Beginner here. I'm trying to get the values of normal.y in the table cols
in bump, to then change the variable self.onGround, but I just can't do that. Either the code is wrong or the logic is, but I don't know why. This is the code I think was supposed to work:
Code: Select all
for i=1, len do
if cols[i].normal.y == -1 then
self.onGround = true
end
Davidobot
Party member
Posts: 1226 Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:
Post
by Davidobot » Sat May 28, 2016 6:10 am
Crono wrote: ..
Try checking if the normal is 1 instead or 0, one of those should work, I think.
Crono
Prole
Posts: 5 Joined: Mon May 09, 2016 4:35 am
Post
by Crono » Sat May 28, 2016 3:45 pm
Davidobot wrote: Crono wrote: ..
Try checking if the normal is 1 instead or 0, one of those should work, I think.
If I do that the variable never gets true.
Davidobot
Party member
Posts: 1226 Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:
Post
by Davidobot » Sat May 28, 2016 4:40 pm
Crono wrote:
If I do that the variable never gets true.
Is the variable ever true when you check for -1?
If anything you can just check if there is a block 1 px under the player.
Crono
Prole
Posts: 5 Joined: Mon May 09, 2016 4:35 am
Post
by Crono » Sat May 28, 2016 5:07 pm
Davidobot wrote: Crono wrote:
If I do that the variable never gets true.
Is the variable ever true when you check for -1?
If anything you can just check if there is a block 1 px under the player.
I had the code for this and I remember that the value was -1, but I deleted it because I'm and idiot. I'm already using the 1 pixel for now.
Users browsing this forum: Google [Bot] and 4 guests