Perfect(?) Walking

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Chucknorrisaurrus
Prole
Posts: 23
Joined: Mon Jun 07, 2010 1:00 am

Perfect(?) Walking

Post by Chucknorrisaurrus »

I'm excited. Not because I've never made something like this, I've done this plenty of times, but not on LOVE. I've made my first little program. This is also my crappy payment to those who helped me with some of the questions I had, although I'm sure those who have such extensive knowledge of the language will find no use of this.

Regardless, here it is. This is, as far as I know, seamless walking. I was looking into how to make a walking character and found a post by Bartbes. However, when I looked at his/her code, I couldn't figure out for the life of me how it worked.

Code: Select all

function love.update(dt)	
	if walking then
		anim:seek(step*4+direction)
		steptime = steptime + dt
		if steptime >= 0.25 then --change this
			step = (step%2)+1
			steptime = steptime - 0.25 --and this
			--if you want another delay
		end
	else
		anim:seek(direction)
	end
end
After looking at it for a while I figured out what he/she was doing with this code and implemented it into my program. Big thanks to him/her, though, for this snippet.

Constructive criticism is always appreciated, It's nice to know exactly what is "not tickling everyone's fancy" so to speak.

EDIT: Oh, and before the posts come rolling in, I know the code is sloppy. I cleaned it up as best as I can, but.. well, you know.
Attachments
Seamless Walking.love
The program.
(6.3 KiB) Downloaded 190 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Perfect(?) Walking

Post by Robin »

Interesting. If you change directions, however, the guy's walking backwards for a short time.
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Perfect(?) Walking

Post by bartbes »

First of all, I have no memory of that snippet...
Second, and this is important: I'm male.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Perfect(?) Walking

Post by Robin »

Aren't you genderless, as a sentient machine?
Help us help you: attach a .love.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Perfect(?) Walking

Post by TechnoCat »

Robin wrote:Interesting. If you change directions, however, the guy's walking backwards for a short time.
It appears to wait for the end of the animation cycle to switch.
User avatar
Chucknorrisaurrus
Prole
Posts: 23
Joined: Mon Jun 07, 2010 1:00 am

Re: Perfect(?) Walking

Post by Chucknorrisaurrus »

bartbes wrote:First of all, I have no memory of that snippet...
Second, and this is important: I'm male.
lol, my bad. And here's your post about it.
Post Reply

Who is online

Users browsing this forum: No registered users and 63 guests