I tried using love.physics to shoot bullets on a top-down map with several obstacles.
My first thought was that using love.physics might come in handy at some point and I wanted to use it anyway, so I gave it a shot.
But now I think that a very fast, very small bullet might not be suitible for love.physics/box2d.
Creating, fireing and colliding the bullets really was not much of a problem and I was happy with my choice. But I can't get the bullets to any "bullet like" high speed at all.
bullet creation:
Code: Select all
projectile = {};
projectile.body = love.physics.newBody(World, player.pos.x, player.pos.y, "dynamic");
projectile.shape = love.physics.newCircleShape(1);
projectile.fixture = love.physics.newFixture(projectile.body, projectile.shape);
projectile.body:setBullet(true);
local speed = 10000;
local x = speed * math.cos(player.rot);
local y = speed * math.sin(player.rot);
projectile.body:applyLinearImpulse(x, y);
And I want to say that I have searched the internet/this forum without helping results before posting here, but I am sure you hear that a lot ...
I could supply a .love file, but the code looks horrible as it just grew over the past few hours from a small idea.
Any help in any direction would be much appreciated!
rellig