Page 1 of 2

Getting the movement like this.

Posted: Wed Oct 08, 2008 4:19 pm
by FoiL
So after I saw this I got obsessed with making something similar and even started using LOVE(damn you you weird O with your non-existence in my keyboard) a couple of days ago.
But getting the keyboard movement is completely kicking my ass, any ideas on how I can accomplish this feat?

Re: Getting the movement like this.

Posted: Wed Oct 08, 2008 9:12 pm
by surtic
Something like this?

Re: Getting the movement like this.

Posted: Wed Oct 08, 2008 10:14 pm
by FoiL
Dude I...I just love you :D

edit

"math.cos(math.pi * obj.angle / 180)"

So this is where I failed horribly, I completely forgot about the math.pi.

Re: Getting the movement like this.

Posted: Thu Oct 09, 2008 4:56 pm
by surtic
Yes, LÖVE uses degrees, but Lua (math.sin and math.cos) uses radians...

Ah well...

Re: Getting the movement like this.

Posted: Thu Oct 09, 2008 5:25 pm
by nightvenom
Although i had no use for this, its pretty damn epic, didn't even know you could do that 0.o ill be fooling around with this ^^

Re: Getting the movement like this.

Posted: Sat Oct 11, 2008 10:40 pm
by FoiL
So I finally have some time to mess around with this.

The next thing I wanted to implement would be a firing mode and another player. The second part isn't much of an issue, but the first one is and a big one at that.

I was thinking about making a body with a bullet sprite and make travel in the tanks center with it's direction and angle, so that when told to be fired it roars in the direction that the tank is facing and after some time another bullet is spawned in the tank.

The theory is pretty and all. But implementing it is the hard part, is it possible to apply an impulse to a body according to it's angle?

Re: Getting the movement like this.

Posted: Sat Oct 11, 2008 11:13 pm
by Lord Tim
True story: The abandoned game concept in that video was made in Löve. :D By me. :D

Re: Getting the movement like this.

Posted: Sat Oct 11, 2008 11:50 pm
by FoiL
Indeed, thanks for making me a LOVE addict :mrgreen:

Re: Getting the movement like this.

Posted: Sun Oct 12, 2008 6:39 pm
by FoiL
Ok, I somehow got the slug to be fired in the correct direction (seriously I have no idea how I did it) so now I just have to spawn a new slug in the tank after a predetermined time or after a collision.

Any thoughts on that?

Re: Getting the movement like this.

Posted: Sun Oct 12, 2008 7:11 pm
by surtic
After you shoot, set a counter (number of seconds to wait), and subtract dt in each call of update(dt).
When the counter is zero (or less than zero) you know that the time has passed and you can allow another shot.