how to shoot large laser

hello to all,
i can’t figure how to implement a big larger beam, like the beam used in metal slug or in other games like gradius,
an example here:,137130/

its a short sprite and its resized in real time?
or there is a better way to doit, thanks in advance.

Which engine/framework/library are you using?

Here’s a general approach:

Create a long quad that has the dimensions of your laserbeam.


  • Create for example a 16x1 texture that represents a “slice” of the laserbeam.
    You lay out the uv coordinates so that the texture is matching the quads thickness (or “thinness” ;D).
  • Or use a texture that is stretched to your quads size, like the one below

[This is not my image, please don’t use it]

Then you just need to transform and rotate the quad to make it fit into your scene.

pure and clean java, but i want the functionality in gral.

basically is stretching the asset?

but how do i make the colision, with the stretched values?

and if my laser i like the one in the picture, how can i transform the rounded edges, with a rectangle would not happen

The image is not just stretched, it is projected onto the quad, but since you use java only this won’t work exactly like i described.
I also do not know anything about gral and also not much about java2d, so I’m sorry but i cannot really help you much further.

You might want to look at these tutorials covering some basic java2d shape stuff:

The last part explains gradients and textures (TexturePaint). You can then modify what they have done by using the api:

thanks bro, i apreciate

by gral i ment general, like generic, BTW

Oh ;D
I looked it up and there is an actual library called “GRAL” for drawing pie-chart stuff:

You basically have three different images, two endcaps (or one if you want it symmetric) and a middle section. The endcaps are drawn as normal on the two ends of the laser and the middle section is stretched along the length. This keeps details like the rounded corners, but allows you to change the length real-time. This is basically a simplified version of a nine-patch.