Page 2 of 3

Re: How can I make my character jump?

Posted: Tue Apr 17, 2012 7:08 am
by Robin

Code: Select all

      player.y = player.y - player.ySpeed * frame -- If we are, We undo that moving down
That way, the player will hover above the ground a tiny bit. To fix that, I would make that line:

Code: Select all

      player.y = 400

Re: How can I make my character jump?

Posted: Tue Apr 17, 2012 10:24 pm
by Puzzlem00n
Yes, I know, but I didn't do that because it makes the code easier to adapt to real platforms, like tilemaps or whatever else.

Re: How can I make my character jump?

Posted: Wed Apr 18, 2012 5:11 pm
by Robin
Then I would still do something like:

Code: Select all

      player.y = colliding_platform.y
That, or proper collision resolution, which is hard.

Re: How can I make my character jump?

Posted: Wed Apr 18, 2012 9:47 pm
by clickrush
wait a minute. I allways thought that is the proper version haha.

Re: How can I make my character jump?

Posted: Sat Apr 21, 2012 3:37 pm
by Kasperelo
For me, I only get an error. It says: } expected to close {.
when I already have a } ?

Re: How can I make my character jump?

Posted: Sat Apr 21, 2012 6:37 pm
by Robin
Maybe it was closed at the wrong position, or you have more than one {.

Re: How can I make my character jump?

Posted: Sun Apr 22, 2012 1:05 pm
by Kasperelo
Well, I only get an error message...

Re: How can I make my character jump?

Posted: Sun Apr 22, 2012 2:15 pm
by Qcode
I wasn't able to make the gane run at all (That's probably because it's incomplete) but to get rid of the error messages you have to do this.When you make a table you have to put commas after each "entry". So instead of having it like this.

Code: Select all

player = {
		guy = love.graphics.newImage("graphics/mobs/player1.png")
		x = 475
		y = 375
		health = 3
		Xspeed = 5
		yspeed = 0
		gravSpeed = 1.5
	}
You would have it like this

Code: Select all

player = {
		guy = love.graphics.newImage("graphics/mobs/player1.png"),
		x = 475,
		y = 375,
		health = 3,
		Xspeed = 5,
		yspeed = 0,
		gravSpeed = 1.5
	}
Also in your code you have these last few lines.

Code: Select all

if gamestateExtra == "playing" and love.keyboard.isDown("w") then
		if inAir == false then
			player.y = 
		
	
end
You'll need to fill in and finish that statement or else you will get an error message. I wasn't sure what you were planning with that so I just filled in some thing random like this.

Code: Select all

if gamestateExtra == "playing" and love.keyboard.isDown("w") then
		if inAir == false then
			player.y = 375 -- Fill in 375 with whatever you need.
		end
	end
end --  Don't forget to add these ends on.
Also in your conf.lua you had the version as "0.1.0" This isn't the version of the game it's the version of love it was made for. I assumed 0.8.0 So I changed that to 0.8.0. One last thing if you want your changes in the conf.lua to work before your love.load you need to put require "conf" like this

Code: Select all

require "conf"

function love.load()
This won't make your game work because it seem like you haven't set up your menu or other features yet. This will however remove all of the error screens. I have attached a .love with all the edits.

Hope this helps,

Qcode :awesome:

Re: How can I make my character jump?

Posted: Sun Apr 22, 2012 2:31 pm
by Nixola
Require 'conf' is completely useless, 'cause LOVE does it automatically

Re: How can I make my character jump?

Posted: Sun Apr 22, 2012 5:02 pm
by Kasperelo
What?