My brother has recently suffered from a shortage of hands and a lot of games. After many code attacks, I found that my fingers have a bit of nerves, therefore, flappybird can only get single-digit scores (of course, I have never seen any high-score tutorials or any cheating methods)
But I am still angry. I plan to get a pipe that will allow me to automatically drill through the flappybird!
I found a web-based bird resource on the Internet. After that, I felt the resource was ugly and incomplete, and the background was absent. I was angry again.
Think about it. The most primitive resource is the resource in the game package. So I plan to remove it from it!
1. Find the image from the pixel bird apk that has been spelled through tools such as texturePacker. Right, take a decompress software and open the apk. Find it! Assets \ gfx \ atlas.png
2. this is a fight image. To know how this image is spelled out, you have to find the configuration file and continue to find it, that is, res/raw/atlas.txt to open this file, you will find something like this
How can we interpret these numbers? Listen to the following decomposition:
First, each row represents an image resource. The first row is known as a file name.
The second and third are the width and height of the image, in pixels.
The fourth and fifth are the x and y coordinates of the point in the upper left corner of the image, this is the proportion of their coordinates to the entire image (in other words, the coordinates of the vertices in the upper left corner of the image when the length and width of the entire image are 1)
The sixth and seventh are the proportions of the total length and total width of the image width and height.
3. After learning the above information, programmers will smile, and I won't cut you out! You need to use ps to cut it slowly. I will not stop you, but it will be better to let the computer automatically cut it for me!
I used python + opencv to cut the image. (I set up the environment on the window when I started Raspberry Pi, so I didn't hesitate ), to find out how to configure the environment, search for "python opencv environment setup"
Code? I added comments and pasted them below.
Import cv2.cv as cvimport osimg = cv. loadImage ("e:/output/atlas.png",-1) # Read the source image (this is the image that was spelled out, and I changed the name) mask = cv. loadImage ("e:/output/atlas.png", 0) # Read maskwidth, height = cv. getSize (img) img2 = cv. createImage (width, height), 8, 4) # create an image cv with transparent background. copy (img, img2, mask) # copy file = open ("e:/output/atlas.txt") # This is the input file for line in file: strs = line. split ("") fileName = strs [0] imgWidth = int (strs [1]) imgHeight = int (strs [2]) imgX = float (strs [3]) * width imgY = float (strs [4]) * height cv. setImageROI (img2, (int (imgX), int (imgY), imgWidth, imgHeight); # sets the region cv. saveImage ("e:/output/" + fileName + ". png ", img2) # Save it to this path based on the Read File Name
4. run the Code directly after you copy the code of your brother. You will be surprised to find that all the materials in your Output Folder are the materials of this bird game, the following is a small game where all the pictures are pasted to brother.
5. For the children's shoes whose materials cannot be obtained after the above steps, the friends who can get the materials will give them a moment of silence!
6. Let's look at another figure to envy you.