Page 1 of 1
LBJ Picks Up His Pants
Posted: Thu May 16, 2013 10:37 pm
by Inny
Hi guys, it's been a while, but I have a demo here for you to play with. I was going to create a whimsical game in which you play President Lyndon B. Johnson going to pick us his pants from dry cleaning. However, the joke got less funny as I worked on it, and then I lost interest in the project. Since it's been a few months and the project has no steam, I've decided to give it up. Here's the Love file, and if anyone wants to rip it apart and steal code, feel free to.
- CCcKTB0.png (6.85 KiB) Viewed 121 times
Controls:
Left and Right to Move
Z to jump
X to throw a Knife
F10 to quit
Re: LBJ Picks Up His Pants
Posted: Thu May 16, 2013 10:57 pm
by veethree
I get an error when pressing any of the arrow keys. "Input.lua:97: bad argument #1 to 'char' (invalid value)" I'm on my mac in case that has anything to do with it.
Re: LBJ Picks Up His Pants
Posted: Fri May 17, 2013 12:17 am
by Jasoco
Yeah. Same thing. Looking at your code, you're doing it... interestingly. Not the way I would do it.
Change line 97 to the following:
The "k" returns the key's actual name, not its Unicode.
Instead of:
Using the key string name works fine. The Character Code for the Left key for example doesn't exist as a Unicode. See, Unicode is not the same on all machines I believe. Either way, string.char does not recognize all keys so if one does not exist, it returns as a value you can't use in your key table. So use the string instead as all keys have a string value. So it'll work fine with the string.
That said, very impressive. I like the different tiles having different collisions so you only pass through one way. Really neat. Just fix that one problem and it works fine on both OS X and Windows.
Re: LBJ Picks Up His Pants
Posted: Fri May 17, 2013 2:35 am
by Inny
That was bizarre. I don't use the Input.kp or Input.last_key, it must have gotten copy+pasted from another project (which means I need to go hunting for where it came from). At anyrate, I made the change, thanks guys! Enjoy!