Create one large image out of many small ones? LÖVE - lua

Is it posible to create a drawable object out of some other drawable objects? And How would I do it?

Use a Canvas and draw the smaller images into it.
bigger = love.graphics.newCanvas(100, 100)
bigger:renderTo(function()
-- draw images here using love.graphics.draw etc...
end)
and then later use the canvas instead of the smaller images:
love.graphics.draw(bigger)

Related

Tiled Software for Map Creating: Make Tiles out of a entire map

Can you drag an image and have tiled create map and brake the image into small tiles for you. I don't know if it's possible. Like I have image done for my game and I have it in .png file which about 2680 * 1080 and I want to create that image in tile based so i can do A* Pathfinding algorithm.
or if you guys know any other alternative way to do it then please advice me on it.
Thanks in advance.
That is how Spritesheets work. Those are big images containing several small tiles.
When adding a new Tileset in Tiled, you choose your image and define the tile-size. Tiled will automatically use them correctly

Use image as tileset in Spritekit

I don't find a way to use this sort of images as tile set for my games.
Is there a way to do it, or should I add all object I want one by one ?
I tried to add a new Grid Tile Set then a Single Tile Group, but if I try to use this in a Tile Map Node, it will use all the image as texture for one block.
I don't know if it's possible, but if you can help me, I would be grateful.
Unfortunately you will have to separate the image into smaller images manually..
The functionality you want just doesn't exist.
You can use your image as a texture atlas, but you will not be able to use SKTextureAtlas, you will have to break them out your self.
If you look at SKTexture, you have an init called init(rect: CGRect, in: SKTexture). This will create a new SKTexture object for you, while still referencing the texture memory space of the original texture. You are just going to have to use something like a plist to load in all of the CGRRect info to create this atlas.
Example:
let textureAtlas = SKTexture(imageNamed:"CEm72.png") //I convert your jpg to png somehow
let rectDarkKnight = CGRect(x:0,y:96,width:32,height:32)
let texDarkKnight = SKTexture.init(rect: rectDarkKnight, in: textureAtlas)

As3 Creating a tiled background

First of all, I would like to say that I'm fairly new to AS3, so feel free to correct me when needed.
So I'm trying to create a moving background, made out of different types of isometric tiles, like a floor or a wall, disposen in a grid like fashion.
At first, I tried creating a symbol containing the floor and the wall on different frames, and alternate between the frames as needed. Then I would add multiple instances of this symbol to a container and move the container around. Quickly I realized that this probably wouldn't be an ifficient method, as confirmed by the unsmooth movement of the container. (I gave up on this method).
So I did a little digging around, and then I converted the tile symbol to a png file, created a bitmap container to where I would copyPixels from the png as many times as the map required it.
The problem now is that when I do this:
var pngBitmapData:BitmapData=new tilePng
the bitmapData height and width don't match the height and width of the actual tile. There seem to be some transparent pixels around the tile and I have no idea how to remove them. This causes the tiles to be misaligned on the background's grid, with some small empty spaces around them.
So I have a couple of questions:
Is this an effective way to build the background?
Is there a way to avoid that transparent pixels "problem" ?
Hmm, it's hard to tell without seeing your png.
Are you doing this?
var pngBitmapData:BitmapData = new tilePng();
var bmp:Bitmap = new Bitmap(pngBitmapData);
To initialize your bitmap?
Also, check the anti-aliasing on your bitmap, that could be it. I'd set it to none.

Tiling images with 3D perspective

I'm not quite sure if the captioned is my problem. I will explain the challenge first and then probably you can advise whether I'm doing something fundamentally wrong.
I'm creating an iOS application which will let users drag and drop floor and wall tiles on a room (pre-selected room images only) and can see how that tile will look when laid on the room. I have the tile images and the room image and I've defined hotspots (where tile need to be replaced) relative to the room image.
On my room simulator view, I have a UIImageView which holds the room image and certain parts of that image are made transparent. I also have smaller UIImageViews which I have put on top of the room image.
When the user drags and drops the tile image on the smaller image views, I'm creating an UIImage using the method
[sourceImage resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
which gives me a tiled image and that image is then set as the source of the smaller image view.
This logic is working but I'm not getting the desired effect. If the user is dropping the tile on the floor, the final image looks like the floor and the walls are on different planes. Please checkout the image below
The view on the right has 2 images, the room images with transparency and a smaller image where you see the floor tile now.
So my question is, can I tile images with some sort of 3D perspective ? I'm afraid I'm not that good in 3D transformations and the 3d matrices looks greek to me.
I guess the problem is mostly because of the angle in which we are viewing the resultant image and the floor tile images should be tiled with that in mind. Or in other words, the size of the tile on the back side of the room should be smaller than the size of the tile in the front side. I may be wrong.
Any help would be greatly appreciated.
A bit late, but what you need is "CIPerspectiveTile":
https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html#//apple_ref/doc/filter/ci/CIPerspectiveTile
You'll need to create a CIFilter, set the input values (5 - image, 4 perspective points), then create a CIImage, then draw that image out. There are various ways to do so. You can do something as simple as:
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef tiledImage = [context createCGImageFromCIImage:myCIImageWithPerspective fromRect:boundingRect];

Fire Monkey Image view area

I want to create simple 2d racing game on FM, I have track (racing map) bitmap. Image component must show only part of that bitmap depending on car position. Is there any way to define coordinates of bitmap's start point, from which Image will show this bitmap. If Image doesn't support that, what component does? Thanks.
Use a TSubImage. This component is similar to a TImage, but lets you specify a sub-section of the image to be displayed.

Resources