How can I add transition effects to my LibGdx game? - libgdx

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).

Related

How to draw a filled square behind text in libgdx?

I am developing a grid based game in libgdx. What i want is to know how can i draw a square tile with number written on it which can be moved and scaled.
Its stupidity to design thousands of textures for these numbers and use them as sprites.I want to know if there is any container class in which i can dynamically add text and and set background too.
You can use Scene2d UI components such as Label to create styled text boxes.
Scene2d allows you to do layout and styling of a wide range of components that can easily be manipulated using Actions, or you can create your own components by extending Actor.
To create and display a Label, create a Stage and add the Label to it.
In this context I assume you by "tile" just mean a rectangle.
You don't say anything about what you are doing now. How you draw the numbers.
So this answer is based on almost zero information.
Solution 1:
Use a font with a background color.
Solution 2:
You know the number/how many digits. You know the size of the font. Calculate the size of the text on screen. Use a single narrow background sprite and tile it behind the text.
Solution 3:
Use a textbox from Scene2d.

8-direction Figure Animation with Arrow Keys

I've been charged with designing a demo for an isometric video game in ActionScript 3. I have the bitmap spritesheets that show the avatar I'm using standing and walking in each direction. The walking animation is made up of three frames.
My problem, though, is that I need to figure out how to make use of them. I'm not familiar with animation in Flash, and I need input on how to gotoAndPlay() the walking frames for the right direction. I don't think isolating the necessary DIRECTION is going to be a challenge, so much as starting it and keeping it going while the arrow keys are down.
My current code is basically comprised of keyboard handlers for KEY_UP and KEY_DOWN, each containing a switch-case statement that changes the Avatar.currentDirection property. The handler continues to fire while the keys are down, but I need to add animation to the game.
I've seen some examples where they simply embed the animations into an SWF, propagate an array of the various walking stages, and alternate between them using an EnterFrame event handler, but this seems really clunky. I guess in the end I'm trying to make use of Adobe Animate, but I don't know how you're supposed to do that.
Ops, fortunately i'm working with sprites (atlas animations) right now!.
if i'm right, you just needs to use them for playing some animation with functionality.
if you have a well sized sprite which is tiled with isometric slots like it:
(9 frames sized 64x128)
your work is very easy, only create new movieclip from library, inside it, create a borderless rectangle (which is our mask) in a layer (named mask) then import image to the project, and its better to disabling smooth ability from image properties,
now, inside your movieclip, you have to create new layer (under the mask layer) and add your sprite image for each frame, and change its position:
at last, enable masking for mask layer, then its time of coding,
name your animation queries (like image 3) and for loopable animations, insert gotoAndPlay('anim_name') inside last frame. i hope you are familiar with controling movieclip animations which is basic consept of any flash project.
now to extend it for 8 directions support, you just need to play and switch between dirctions according single and multi keypreses,

Remove Child? AS3

So I'm incredibly new to AS3, and barely know my way around.
I built a simple colouring book game, essentially changing some of the graphics of a tutorial, and replacing numbers and sizes to fit what I wanted to achieve. I then built a menu screen in a seperate scene and linked the two with code snippets and buttons to go back and forth.
The colour pickers are generated when the game is ran, however an issue I seem to be facing is that when I go back to my main menu, they are still there.
Can someone point me in the right direction as to how I can fix this? I'm sure it's a rather simple fix. I can provide the code from the tutorial if needed
I think you're right you need removechild this color to remove one color from stage... Maybe you need removechildren to remove all color, whin are on stage... Try this two way

Alternate of masking technique to ignore mouse event on parts on asset

In my isometric flash game I have some models with long shadows. I want to ignore the mouse events (move, click, down and up) when the user performs any action on the shadow part of the image. (see sample image)
I know there is a way we can do it by creating a mask in flash. But what if I want to handle it on the .png images (bitmap)? Do I need to create a mask image for all such images? I think it will be very big deal unless there are easy ways (using tools in Photoshop).
Update:
Looking for a "codable" solution to handle the shadows (like the one Richie_W said
Get the pixel colour value where the mouse was clicked - If it is the
shadow colour you can then ignore the click
NOT a solution which involves art work, like creating mask asset or creating shadow asset etc
My friend told me cityville is not using masks but they are handling from code.
Does any one know how it can be done? OR
It can't be programed and only way is to create masks?
There are a number of options you could try (IMO in order of solution quality):
Update your system to seperate out the shadow asset from the thing casting the shadow. From there it is easy to only attach a click listener to the correct asset. This system allows for future improvements such as changing the shadow asset at runtime (Different times of the day etc) without having to deal with updating the click listener node.
Get the pixel colour value where the mouse was clicked - If it is the shadow colour you can then ignore the click. This is a pretty flaky solution but quick to implement.

card flip effect with Five3D and TweenMax/TweenLite

I want to create a card flip effect where I have a card front image, and a card back image. Is there a way to do it so that I have two images in 3d space, one in front of the other, and just rotate their container? If not, how can I achieve this? Also, while i'm using Five3D, i can probably figure out how to convert it if anyone has an example in another library such as papervision3D.
Soulwire has a neat solution which extends Sprite. It just adds a "front" and "back" properties (can be any DisplayObject) and handles everything else automatically. Nice if you just need simple two sided planes, but don't want to get elbow deep into a 3D framework.
http://blog.soulwire.co.uk/code/open-source/two-sided-planes-in-flash-player-10
If you don't need 3d and can use flash10, I suggest going with SideDetector.
With ppv3d, you could create 2 planes with a one-sided texture, flip one and stuff them into a group. I'd assume you can do something like that with Five3D as well.