Im is working on a 2d game in java swing, where the procedure-created environment is represented by a tiled array of low-resolution images. This is currently all in html tags (for line breaks) in JLabel.
In addition, I would like to display character sprites that will not process the entire slab, but will have some alpha components. Previously, in JS / html and JS / canvas, I simply made sketches with alpha channels and positioned them directly above the floor tiles using tables and / or absolute positioning.
In java swing, however, absolute positioning (and most of the html for that matter) does not seem to work so well.
Since the sprite will never be between / overlapping double-decker slabs, the obvious solution is to create a bunch of precomputed image files outside the game - one for each character on each type of floor tile, however this (and work) exponentially with the number of images used and it seems not necessary.
From what I saw, it seems like it should be possible to create all these images at runtime in the form of Bufferedimages, either by pre-computing them at startup, or by creating each frame if necessary.
If I can do this, I can also put all the images that I need into one large raster file of each frame and display it. It can also reduce unsynchronized frame loading if I overload the system.
From the options above, what seems the best? Or is there another obvious solution that I completely lost? If the solution is to create composite images, can someone point me in the right direction how to do this? Many thanks.
source
share