Search found 25 matches

by eliasaif
Thu Jun 18, 2009 11:51 am
Forum: Support and Development
Topic: My ongoing newbie questions
Replies: 43
Views: 13247

Re: My ongoing newbie questions

Good point! :)
by eliasaif
Thu Jun 18, 2009 7:30 am
Forum: Support and Development
Topic: My ongoing newbie questions
Replies: 43
Views: 13247

Re: My ongoing newbie questions

Jake: This code will make the object accelerate smoothley. newX, newY = -0.5*math.cos(-3) + vx, -0.5*math.sin(-3) + vy Ofcourse you can do something like this if you don't want any acceleration: //Move left newX, newY = vx -5, vy //Move right newX, newY = vx + 5, vy But when you do that, the velocit...
by eliasaif
Wed Jun 17, 2009 8:16 am
Forum: Support and Development
Topic: My ongoing newbie questions
Replies: 43
Views: 13247

Re: My ongoing newbie questions

Here is my solution of moving left and right with my avatar: //Moving left vx, vy = playerbody:getVelocity() if love.keyboard.isDown(love.key_left) then //This gives an acceleration to the avatar body newX, newY = 0.5*math.cos(3) + vx, 0.5*math.sin(3) + vy //Here, I set a maximum speed of the avatar...
by eliasaif
Wed Jun 17, 2009 7:58 am
Forum: Support and Development
Topic: Velocity in Y axis never gets 0
Replies: 4
Views: 893

Re: Velocity in Y axis never gets 0

I thought that the code in the earlier post solved my problem. But it didn't. It works fine as long as you just press the jump button once. But if you press the jump button one more time when the jumping object is in the "air", the object reaches the ground as it should, but when you try to jump aga...
by eliasaif
Sat Jun 06, 2009 3:26 pm
Forum: Support and Development
Topic: Camera moving
Replies: 19
Views: 5897

Re: Camera moving

Thanks for all good ideas! Now I have solved my problem. It's not really anything like the above, but it works fine. Here's my code if someone's interested. playerx = playerbody:getX() playery = playerbody:getY() originx, originy = getCamera():getOrigin() width = love.graphics.getWidth() height = lo...
by eliasaif
Sat Jun 06, 2009 9:32 am
Forum: Support and Development
Topic: Camera moving
Replies: 19
Views: 5897

Re: Camera moving

I tried to do like this: playerx = playerbody:getX() playery = playerbody:getY() originx, originy = getCamera():getOrigin() width = love.graphics.getWidth() height = love.graphics.getHeight() playerviewx = playerx - originx if playerviewx % width <= 1280/50 then x = originx + width getCamera():setOr...
by eliasaif
Fri Jun 05, 2009 11:14 am
Forum: Support and Development
Topic: Camera moving
Replies: 19
Views: 5897

Re: Camera moving

Isn't originx what you call playerviewx? It's the current origin of the camera.
by eliasaif
Thu Jun 04, 2009 6:59 pm
Forum: Support and Development
Topic: Camera moving
Replies: 19
Views: 5897

Re: Camera moving

Oh! I've done it again! I'm sorry for that. I'm just used to run thing the way they are ment to be.
by eliasaif
Thu Jun 04, 2009 5:45 pm
Forum: Support and Development
Topic: Camera moving
Replies: 19
Views: 5897

Re: Camera moving

It's like it's looping the moving process by it self. Something must still be wrong in the code. I've attached the game below.
by eliasaif
Thu Jun 04, 2009 7:51 am
Forum: Support and Development
Topic: Camera moving
Replies: 19
Views: 5897

Re: Camera moving

Hi again! I still can't find out how to do this.. I've tried something like this code: if playerx % width <= 2 then getCamera():setOrigin(x, y) elseif playerx % width >= width-2 then getCamera():setOrigin(x, y) end The problem is that I can't figure out what I should set the camera origin to. In thi...