Page 1 of 2
Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 7:50 am
by Stormatree
My first real script that i made. All the ones before this have just been stupid ones that say stuff like "Hello World".
Download for Windows only here -
http://anyhub.net/file/not_megaman.zip
If you want to see the raw code just change the executable from .exe to .zip and extract the contents.
On a side note, does anyone know a method to combine the .love and .exe together and make it have a different icon other than the default Love icon?
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 8:08 am
by nevon
I'm going to take a wild guess here and say that you're not using the dt variable correctly.
Also, why distribute as an exe? Makes no sense.
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 8:11 am
by Stormatree
I'm sorry
Keep in mind though, this is my first script.
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 8:46 am
by nevon
Right now, what you're doing is (when moving around) taking the character's position and adding a value each update. So if you have a really slow computer, maybe it runs 100 updates per second. That would mean that for each second, your character moves xmove*100 pixels (in your case that would be 300 pixels). On a really fast computer you might run that same update loop 10000 times, which would move the character xmove*1000 pixels per second (or 30000 pixels, in your case).
To make it so that the character moves at the same speed regardless of how fast the computer is, you can use the dt variable like so:
Code: Select all
function love.load()
xmove = 80
x = 100
end
function love.update(dt)
x = x + xmove*dt
end
dt is the time that has passed since the last update and this update, so by multiplying your movement by that, you make sure that the character always moves 80 pixels per second - regardless of how fast the computer running the game is.
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 9:11 am
by Stormatree
I just added this to my code, but now megaman has a 1 pixel purple trail, and when it stops, it goes blurry.
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 9:18 am
by nevon
Stormatree wrote:I just added this to my code, but now megaman has a 1 pixel purple trail, and when it stops, it goes blurry.
That's probably because he's on a non-integer position (so instead of being on x:10, y:15, he's on 10.43256, 15.95381). That makes the drawing a little funky when you're using pixel art (which has to be perfectly sharp). Either round to the nearest integer or
set the image(s) filter mode to nearest.
Disclaimer: I'm pulling this out of my ass. I don't actually know if that's the problem, but it seems like it could be.
EDIT: Yup. The filter mode seems to have worked.
Code: Select all
image_right:setFilter("nearest","nearest")
image_left:setFilter("nearest","nearest")
image_downup_right:setFilter("nearest","nearest")
image_downup_left:setFilter("nearest","nearest")
image_station_left:setFilter("nearest","nearest")
image_station_right:setFilter("nearest","nearest")
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 9:34 am
by Stormatree
Thank you
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 1:07 pm
by thelinx
Think you can upload a new .love with the current fixes?
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 9:41 pm
by Stormatree
The only thing that's troubling, is that the X and Y variables are all ways long decimals.
Re: Not Megaman - My first game (WIP)
Posted: Tue Jul 27, 2010 9:55 pm
by theZohnn
has great potential, but would you mind making the image dimensions a power of two? on crappy computers like mine the image shows up as a white box.
and be sure to poast the .love file anyways, i like to see how i can help.