## How can I make my character jump?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: How can I make my character jump?

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
Help us help you: attach a .love.

Puzzlem00n
Party member
Posts: 171
Joined: Fri Apr 06, 2012 8:49 pm
Contact:

### Re: How can I make my character jump?

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.
I LÖVE, therefore I am.

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: How can I make my character jump?

Then I would still do something like:

Code: Select all

      player.y = colliding_platform.y
That, or proper collision resolution, which is hard.
Help us help you: attach a .love.

clickrush
Citizen
Posts: 83
Joined: Tue Dec 13, 2011 12:50 am

### Re: How can I make my character jump?

wait a minute. I allways thought that is the proper version haha.
Sry about my english.

Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

### Re: How can I make my character jump?

For me, I only get an error. It says: } expected to close {.
when I already have a } ?

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: How can I make my character jump?

Maybe it was closed at the wrong position, or you have more than one {.
Help us help you: attach a .love.

Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

### Re: How can I make my character jump?

Well, I only get an error message...
Attachments
2dshooter.love.zip
(1.71 KiB) Downloaded 37 times

Qcode
Party member
Posts: 170
Joined: Tue Jan 10, 2012 1:35 am

### Re: How can I make my character jump?

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

Nixola
Inner party member
Posts: 1944
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

### Re: How can I make my character jump?

Require 'conf' is completely useless, 'cause LOVE does it automatically
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

### Re: How can I make my character jump?

What?
Attachments
2dSHOOTER.love
(1.76 KiB) Downloaded 44 times

### Who is online

Users browsing this forum: No registered users and 25 guests