Not Megaman - My first game (WIP)

Show off your games, demos and other (playable) creations.
Stormatree
Prole
Posts: 7
Joined: Tue Jul 27, 2010 7:45 am

Not Megaman - My first game (WIP)

Post 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?
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Not Megaman - My first game (WIP)

Post 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. :death:
Stormatree
Prole
Posts: 7
Joined: Tue Jul 27, 2010 7:45 am

Re: Not Megaman - My first game (WIP)

Post by Stormatree »

I'm sorry :( Keep in mind though, this is my first script.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Not Megaman - My first game (WIP)

Post 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.
Stormatree
Prole
Posts: 7
Joined: Tue Jul 27, 2010 7:45 am

Re: Not Megaman - My first game (WIP)

Post 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.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Not Megaman - My first game (WIP)

Post 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")
Stormatree
Prole
Posts: 7
Joined: Tue Jul 27, 2010 7:45 am

Re: Not Megaman - My first game (WIP)

Post by Stormatree »

:awesome: Thank you
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Not Megaman - My first game (WIP)

Post by thelinx »

Think you can upload a new .love with the current fixes?
Stormatree
Prole
Posts: 7
Joined: Tue Jul 27, 2010 7:45 am

Re: Not Megaman - My first game (WIP)

Post by Stormatree »

The only thing that's troubling, is that the X and Y variables are all ways long decimals.
User avatar
theZohnn
Prole
Posts: 20
Joined: Tue Jul 20, 2010 7:50 pm

Re: Not Megaman - My first game (WIP)

Post 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. :nyu:
+1 internet to anyone that helps me! i am a lost little puppy!
Post Reply

Who is online

Users browsing this forum: No registered users and 79 guests