Play .gif animation in dynamic x,y - Android - java

I'm trying to play gif animations on certain x,y coordinates.
i tried using the Movie class, but sadly most gif animations plays wired and not smooth enough.
In the Movie class i could simply set x,y coordinates of where i want my movie to be,
Now i want to use the GifDecoder class, but have no idea how to play it in dynamic x,y coordinates which changes all the time, and also make it seem smooth.

If you want to use GifDecoder, then here are some resources that I think might help you.
A tutorial can be found here.

Related

How do I make 2d- Flashlight effect in Processing 3

For reference the effect I'm going for is this:
I'm working in Processing 3, NOT p5.js.
I've looked around processing forums, but i can't find anything that works in the current version or doesn't use PGraphics and a mask which from what I've read can be expensive to use.
My current ideas and implementations have resulted to drawing shapes around the player and filling the gaps in with a circles with no fill that has a large stroke weight.
Does anyone know of any methods to easily and inexpensively draw a black background over everything except a small circular area?
If this is the wrong place to ask this question just send me on my way I guess, but please be nice. Thank you:)
You could create an image (or PGraphics) that consists of mostly black, with a transparent circle in it. This is called image masking or alpha compositing. Doing a Google image search for "alpha composite" returns a bunch of the images I'm talking about.
Anyway, after you have the image, it's just a matter of drawing it on top of your scene wherever the player is. You might also use the PImage#mask() function. More info can be found in the reference.

Simple way to put graphic on the screen in android

I've been looking around for a simple way to put graphic on the screen in android for a while now and I'm really confused.
I've a simple game written in java with swing for graphics and that's all I really need as the graphics doesn't really matter in this project.
Now we want to rewrite it so it works on devices with android and honestly I can't find a simple way to just put a image on the screen.
I'd love to avoid using complex game engine because I just don't need it. All I want is a possibility to draw an image (or 50 images) on x,y given by me and refreshing a screen every 100 milliseconds and I thought I'd be the first thing I'd learn in any android tutorial but well... it's not. Of course I know how to draw an Image with .xml but I need something more automatic - for dozens of images changing all the time.
So what is the best to do this? Isn't there really any way to do it with just some android built in function? If not what engine should I use just for the simplest things I mentioned?
A simple but not necessarily very clean way to do this would be to create an xml layout that is just an empty RelativeLayout.
Then you could create your images like this:
ImageView image = new ImageView(this);
image.setLayoutParams(new RelativeLayout.LayoutParams(IMAGE_WIDTH,IMAGE_HEIGHT));
//Other setup code for your image goes here
myRelativeLayout.addView(image);
This should give you an image of the specified width and height that sits at the origin.
Then you could move the image into position like this:
image.setX(IMAGE_X_POS);
image.setY(IMAGE_Y_POS);
When to do the moving is up to you as it will depend on when you know the positions that need to be moved to.

how to i animate an object in android?

Hi i'm looking for a way to animate these little icons i have for an app i'm making. basically i want 3 little icons to slide from the top of the portrait android screen to the bottom continuously and randomly. I have searched a lot so sorry if this is a repeat but i just cant quite find anything i can understand. So far i have Nothing except the images and xml set up. If this is already answered can someone please point me in the right direction. Is there a way to go about this in xml or must i use java? also would it be easier to use a framework such as libgdx with box2D?
you can use surfaceview and making your whole screen as a canvas whereas you need to control your objects' position every millisecond, another option is using the Animation in android, you can refer to this link it is sliding from left to right and vice versa

How to make Standard game design/layout through Surfaceview

I have used SurfaceView in my game. Right Now, I have created layout considering one device (320 x 480). The game layout looks nice and all functions are working properly. But when I see the same game in another device with different dimension (screen size), the layout does not seem to be proper.
So is there any property, method, formula or helping Tutorial by which I can create game design/layout through canvas which looks same in all screen size devices.
There is one simple hint: don't ever use absolute coordinates on the SurfaceView. Every item's position should be calculated at runtime depending on the actual screen size. This way you'll achieve a layout that will look the same way on every device. Hope this helps.

android opengl game

I'm trying to develop a 2D game to android using opengl.
I know how to print images on the screen and animate them. But in my game I have a map and a want to zoom in and out and scroll the map. But I can't figure out the best way of doing it.
Can anybody help me?
I don't have any api examples but I did games design at college so I'll give my two bits.
The method you use will depend on your map style, size, functionality and format.
For example if you are looking for a very static non changing map, use a simple picture image. You can use the API frame for a picture view, enabling you to zoom in and out as you do in the gallery and to scroll on zoomed images, or in this case, zoom locations on your map.
Alternatively, if your map is based off a tiling system, a good example of this is the original Pokémon and Legend of Zelda games from the old game boy, then each area stores a tile 'thumbnail' for itself as a bitmap. These are then put into their appropriate locations on a grid depending on what areas are discovered.
This is the probably the most flexible way to build your map as you are not relying on a set bitmap for the entirety your map meaning it can change its look efficiently; you can build it as desired to show areas of choice (useful for if the map only reveals places the gamer has covered) and it also means you can do tile based overlay:
ie - if a certain area should contain treasure, theres a treasure icon overlayed on that tiles x,y position on the map grid.
I used the tiling option in my game projects from college and it made everything else map related easier. It also made the map side of things smaller storage wise.
The simplest approach would be to just call glTranslatef(-scrollX,-scrollY,0) followed by glScalef(zoom,zoom,zoom) before you render your map.

Categories

Resources