Getting the movement like this.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Getting the movement like this.

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?

surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: Getting the movement like this.

Something like this?
Attachments
motion.love

FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Re: Getting the movement like this.

Dude I...I just love you

edit

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

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

surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: Getting the movement like this.

Yes, LÖVE uses degrees, but Lua (math.sin and math.cos) uses radians...

Ah well...

nightvenom
Prole
Posts: 36
Joined: Sat Aug 16, 2008 3:07 pm

Re: Getting the movement like this.

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

FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Re: Getting the movement like this.

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?

Lord Tim
Prole
Posts: 30
Joined: Sun Jul 20, 2008 4:07 am

Re: Getting the movement like this.

True story: The abandoned game concept in that video was made in Löve. By me.

FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Re: Getting the movement like this.

Indeed, thanks for making me a LOVE addict :mrgreen:

FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Re: Getting the movement like this.

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?

surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: Getting the movement like this.

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.

Who is online

Users browsing this forum: No registered users and 48 guests