Page 1 of 1

slowly building a boss rush.

Posted: Sat Apr 13, 2013 8:20 pm
by sanjiv
MegaMan based. Basically, two figures going mano-a-mano in a room. I guess I've spent a lot of time learning small stuff, but this is my first attempt to put together a comprehensive package. I'll update it as I go. The biggest challenge for me is figuring out how to structure my files and programs.

My first goal is to get animation running, so I've abandoned collision detection with structures in favor of just a basic x=math.max(x1,math.min(x2,x)) sort of deal.

And ACTUALLY, here's a problem I'm having with sprites v2: When I try and move the contents of love.update(dt) into a separate function of its own, and then call on it, it doesn't seem to work, and I don't know why. Essentially, I want to move that chunk from main.lua into drawSprite.lua.

Re: slowly building a boss rush.

Posted: Sat Apr 13, 2013 11:41 pm
by Ragzouken
The reason your code doesn't work in a function is because you are trying to set the global variable "frame" in the function, but the function creates a local variable "frame" as part of the input arguments - this means when you set "frame" in the body of the function it's actually just setting the local variable that's discarded when the function returns. You'll need to rename one of the variables so they don't clash, or perhaps move frame to be part of the "animate" table.