I'm trying to create a splash page with a loading animation for some sprite batches as part of the AssetManager.
I have successfully created a loading animation bar that scales to represent a percentage bar.
My question is in regards to laying it out on the scene. I decided to go with a table that scales to the width of the scene, which is set to the width of the viewport.
I have added my animation actor to the table, however how to set a background image to the table itself?
Table.setBackground() will do what you need. It works best (IMO) with a NinePatch, but takes a Drawable.
Related
I have WPBakery installed on my wordpress website, and I have tried to have two images in a single widget in a row divided into 5 columns, the two images being in a single column.
One of the images however is a sort of a custom stylized picture frame for the other image. I managed to partially solve the issue by applying a margin of "-140%" on the top margin. Unfortunately I can't get the image to stretch out to fit the frame, also when changing the viewport to be smaller (mobile sized for example), the frame scales proportionally as it should, while the image it self shrinks.
Can anyone help me out on making the image scale proportionally with the image, and also making sure it stretches to the size of the frame?
Note: The images might not be the same resolution as the frame, but i need the image to be stretched to those dimensions.
Here is how it looks on a 1080p monitor, notice how its not stretched to the frame
When it is shrunk to a mobile viewport
In my professional opinion of over 13 years of web development in a business setting, my answer to you is use ONE image. Have a .PSD project for these. Have your image frame as one layer, and use your normal images in another layer on top. When you want to create one of these images, open up the .PSD project, highlight the image to be replaced, and import the new. You may have to crop the new to be the dimensions of the last one and play with the centering x and y. Then, save your new image at full size. It will scale down because it is ONE image, not one image with a hacktastic image background.
I'm making splash screen for my game, i want to display the logo and Name with different Transition effects. I'm a noob here, having no idea of scenes stage n all. If scenes and stages are required, a simple explanation with code would be appreciated.
Thanks.
You can create different screens for the logo and the name, and create a transition between them.
For that, you can use the libgdx-transitions library for creating e.g. some alpha-fading, or sliding transitions:
https://github.com/digital-thinking/libgdx-transitions
Here in the test case you can see how it works:
https://github.com/digital-thinking/libgdx-transitions/wiki
Basically, you create transitions and then you can change them before you change the screen.
Or you could do this on a single screen using the Universal Tween Engine.
With that, you can create a Timeline where you (for example) change the alpha levels of pictures of the logo and the name (make the pictures appear and disappear).
Apologies if this has been answered before, I didn't see anything that matched it perfectly. I've found a ton of resources for sliders that snap to the edge of the current frame, but not my requirements below.
What is the best way to build a simple webpage that has the following:
A top layer, that fills the entire screen, with a 'hole' showing a background layer.
The background layer must be draggable/swipeable horizontally.
The background layer is many time wider than the viewport, so I don't want any snapping until the edges of the image are reached.
I made a little gif mockup to try to show what I'm on about.
Thanks for any help!
I am working with box2d, and generating a few grounds of variable size (all rectangles). The image the grounds use is 500px by 200px, however, when I create and size my grounds, the background image stretches to fill the body. I am trying to have it aligned to top left and just tile with no resizing but am really unsure of how to control it.
I imported the image as a movieclip to my library, if it helps, and also have a basic empty class for it (EarthGround.as). I've been doing a little research but really haven't found anything definitive about manipulating the movieclips associated image.
You have to be specific with that. Maybe a screen shot would help.
Until then, possible causes could be:
Box2D uses real world values where 1 pixel = 1 meter. You have to
choose a scale factor.
Box2d uses the center of any object as its registration point. You
should always do the same with your flash sprite/movieclip, to keep
it simple.
I was wondering how does pygame.blit manages the images blitted on screen. When I blit an multiple images on the screen, I see that each image is stacked on top the previous one.
How do I clear all these images? Wouldn't(somehow) there be a big problem when there are LOTS of images stacking on top of each other on the screen? Currently, I'm just blitting a white bg or custom bg on the whole screen to "clear" the screen. So far no problems or anything since the app I am working on is very small.
When you blit an image to a surface, it basicly draws it on the surface. The location of the blitting or the object blitted is not saved and cannot be changed. It's like if you were painting the images onto a canvas. The new ones would go over the old ones and there would be no way to get rid of one image if it were colliding with another image.
The most common approach to solving this is to just completly clear the screen using surface.fill(), and redraw the images each frame.
To answer your question about if there woudl be problems when there are lots of images, no. The window will only be saved as each individual pixel being a certain color, much like a regular picture you would take a camera, so no matter how many objects you blit, the game will always take the same amount of time.
There are multiple approaches:
Clean the whole background, as you are doing.
If the computer keeps up with the fps, perhaps it's better to leave it like this.
Clean only the areas where you blitted objects (see pygame.sprite.RenderUpdates)
In your case, if you have many stacked objects, perhaps it's better to write your own solution, trying to find the union between colliding rectangles, to avoid reblitting the same background over and over.