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 » Wed Oct 08, 2008 4:19 pm

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 » Wed Oct 08, 2008 9:12 pm

Something like this?
Attachments
motion.love
(2.11 KiB) Downloaded 246 times

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

Re: Getting the movement like this.

Post by FoiL » Wed Oct 08, 2008 10:14 pm

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 » Thu Oct 09, 2008 4:56 pm

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 » Thu Oct 09, 2008 5:25 pm

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 » Sat Oct 11, 2008 10:40 pm

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 » Sat Oct 11, 2008 11:13 pm

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 » Sat Oct 11, 2008 11:50 pm

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 » Sun Oct 12, 2008 6:39 pm

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 » Sun Oct 12, 2008 7:11 pm

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: aimxysan, Google [Bot] and 8 guests