My attempt at a snake clone. Fail.
Posted: Wed Sep 14, 2011 7:44 am
Hello, LÖVErs. I've been creeping around the scenes now for a few weeks, trying to get a good hold on LÖVE and Lua, as well as popping into the IRC channel to get a feel for the community. I'm sort of getting the grasp on the whole thing, or rather I thought I was making good progress haha! Well, this is what I'm working with right now.
I've been working on a snake clone, and I've been doing all of the coding without looking at any others for reference, and it worked great; till it came time to conceptualize how to add more bodies to the original snake after each dot is eaten. I've tried looking at bmzz's snake game but it seriously has me lost in way to many places to count. I just can't grasp what is going on in that source code no matter how many times I look at it. I've been reading through Programming in Lua ( Just got second edition in the mail ) and I'm starting to understand how the ipairs function works and stuff like that, it's just that I can't seem to grasp the idea of what I need to do to get this to work.
I've gotten the movement, spawning of the dots, collision detection (Thanks to the HardonCollider), scoring, etc. Really, all I need to finish the first phase of this game is to figure out how to make the trailing bodies. Then I can work on making a menu and other variables, perhaps obstacles and stuff, but I'll cross that bridge when I get to it
Below is my example right now. I've included many comments so who ever looks at it has a good idea of where I'm going with this whole thing, or at least what I'm thinking or aiming for.
Thanks in advanced, you guys and the wiki are very helpful!
EDIT - Upload didn't work at first.
I've been working on a snake clone, and I've been doing all of the coding without looking at any others for reference, and it worked great; till it came time to conceptualize how to add more bodies to the original snake after each dot is eaten. I've tried looking at bmzz's snake game but it seriously has me lost in way to many places to count. I just can't grasp what is going on in that source code no matter how many times I look at it. I've been reading through Programming in Lua ( Just got second edition in the mail ) and I'm starting to understand how the ipairs function works and stuff like that, it's just that I can't seem to grasp the idea of what I need to do to get this to work.
I've gotten the movement, spawning of the dots, collision detection (Thanks to the HardonCollider), scoring, etc. Really, all I need to finish the first phase of this game is to figure out how to make the trailing bodies. Then I can work on making a menu and other variables, perhaps obstacles and stuff, but I'll cross that bridge when I get to it
Below is my example right now. I've included many comments so who ever looks at it has a good idea of where I'm going with this whole thing, or at least what I'm thinking or aiming for.
Thanks in advanced, you guys and the wiki are very helpful!
EDIT - Upload didn't work at first.