Getting the movement like this.

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.
User avatar
FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Getting the movement like this.

Post 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?
surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: Getting the movement like this.

Post by surtic »

Something like this?
Attachments
motion.love
(2.11 KiB) Downloaded 409 times
User avatar
FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Re: Getting the movement like this.

Post 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.
surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: Getting the movement like this.

Post by surtic »

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

Ah well...
User avatar
nightvenom
Prole
Posts: 36
Joined: Sat Aug 16, 2008 3:07 pm

Re: Getting the movement like this.

Post 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 ^^
User avatar
FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Re: Getting the movement like this.

Post 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?
User avatar
Lord Tim
Prole
Posts: 30
Joined: Sun Jul 20, 2008 4:07 am

Re: Getting the movement like this.

Post by Lord Tim »

True story: The abandoned game concept in that video was made in Löve. :D By me. :D
User avatar
FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Re: Getting the movement like this.

Post by FoiL »

Indeed, thanks for making me a LOVE addict :mrgreen:
User avatar
FoiL
Prole
Posts: 8
Joined: Sun Oct 05, 2008 12:44 pm

Re: Getting the movement like this.

Post 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?
surtic
Citizen
Posts: 74
Joined: Sat Jul 12, 2008 12:18 am

Re: Getting the movement like this.

Post 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.
Post Reply

Who is online

Users browsing this forum: Bule, Google [Bot] and 2 guests