There are different types of guns, a bit like in bubble tank.
A gun has a range limit, the more guns assemble to form a bigger death ray, the greater the range.
There is no notion of aim at the moment.
Speed is important as it allows to flee a bigger ship or reach a smaller one.
A typical combat makes the ship loose a great part of its mass. It has to regain mass to continue fighting or fear death if mass goes below a critical minimum value.
A gun is also defined by the power of its death ray.
Other waypons include
Missiles (two morphs targetting a ship, a propulsor morph and an exploding morph)
Mines (a single morph exploding when target is in range)
TODO :
Create a notion of ship owner (player or AI)
Pick on right click and if it's not user owned, set as firing behavior target.
Create a firing behavior
Decrease energy and mass on the other ship
Render the firing behavior
Detect collision with other ships than the intended target
First we need to detect the distance of every ship to the firing segment. If it is greater than the average ship's radius, it's not fired at.
Else, we need to know what are the morphs outside of the potentially targetted ship. I.e if we draw the smallest convex polygon around the ship, what are the morphs that are not inside it (this must be pre-computed, when we add a solid morph to the ship.
We then need to detect intersection between this polygon edges and the firing segment.
There are different types of guns, a bit like in bubble tank. A gun has a range limit, the more guns assemble to form a bigger death ray, the greater the range. There is no notion of aim at the moment. Speed is important as it allows to flee a bigger ship or reach a smaller one. A typical combat makes the ship loose a great part of its mass. It has to regain mass to continue fighting or fear death if mass goes below a critical minimum value. A gun is also defined by the power of its death ray.
Other waypons include
TODO :