Showing multiple images in Android Canvas for Android Game - android

I have three different images and i want to write a code which will randomly select any of these images and display it at the top of the screen.
Then this image will move downwards and once it reaches the bottom of the screen the image will disappear from the screen.
Now this logic should be continued in the loop where these images will keep on appearing at the top and move towards the bottom of the screen.
I am unable to figure out a way for this. I am trying this on the Canvas.
Basically these three images are kind of Weapons (one is arrow, another is bomb and third one is missile). I want a continuous loop where these images will keep on occurring at the top of the screen and moves downwards and disappear once they reach the bottom.
Can anyone please help me with this?

Related

How to do an infinite horizontal sliding scroll of images on Android using Delphi XE 5?

We want to show in an Android app a list of images in the similar manner with many gallery apps: horizontal sliding by using a gesture to show the next/previous image.
Also the image viewer should support zoom/pinch (besides other features).
Images can came from a database or from a directory and can be as much as 200-300.
The question is: Which is the best way to implement the slide-show part from the environment described above?
Through animations of a two TImage? There exist a specialized component for this? By using Horizontal Scroll box?
Stick 10 TRectangle objects in a THorzScrollBox. It could be more or less than 10 depending on the memory that the device has. Align them all to alTop. Load the images for display in TRectangle.Fill.Bitmap.Bitmap.
When the user scrolls down and is near the bottom of the ten, move the top rectangle to the bottom of the chain and load the newest image from your list into the new bottom one.
When the user scrolls up and is near the top of the ten, move the bottom rectangle to the top of the chain and load the newest image from your list into the new top one.
The reason behind doing it this way is that TRectangle is a really light image display container and you are recycling the TRectangle objects instead of deleting and creating them all the time.
It is possible that you will experience a display pop when you move the next TRectangle object to the top of the chain or when you move it to the bottom of the chain. You will have to create code to take care of this either by setting the position on THorzScrollBox or decreasing and increasing the height of the TRectangle as it leaves or enters the view until it is full size.
If you have installed samples with your Delphi instalation then you can find several examples of how to do this in:
Samples\FireMonkey\Fireflow
Samples\FireMonkey\MetropolisUIFlipViewDemo
Maybe there are even more of them. I haven't checked every sample so far.

Show image randomly(horizontal position) sliding up from the bottom of activity

I would like to show an image come in from different sides(up down left bottom) of my activity, randomly. I want the image to be a gif-animation that slowly shows up and then slowly disappears (like a waving smiley). What would be the easiest way to achieve this? I tried animations but it gets messed up when I try different type of screen resolutions.
Best regards
Joe

Android synchronize animations on two image views

I am animating two image views both having the width of the screen. As soon as the first image starts translating in the x direction right(moving off the screen) the second image appears at the far left of the screen filling the gap of the first image. They continue to move in a infinite cycle. It gives the impression of a rolling scenery.
Everything works perfectly except the line where two images meet. That line flicks. I synchronized the
translation of the images by setStartDelay() method. I also tried using AnimationListener. But that merging line of the two images always flicks.
How to solve this issue or what is the best way to do this animation?

Animation in Android

I want my images which will be moving on the screen to get blasted,say I am writing an application where a balloon is moving on my emulator from bottom to top and on touching, the balloon,it should burst. Is that possible for me?If so how do I write the code for the bursting of the image on touching it? (here image is balloon).Any help would be appreciated,I am in real need of it..

Need help to scroll images

I need to display some images which can be scrolled horizontally. Only one image should be visible on the screen. It should be like iphone screen, which has multiple 4 or more screen and display the items per screen and shows how many screens left as small circles at the bottom. Like that I have show the small circles as many as the images. I tried GestureListener, but it scroll only a single image. Any suggestions pls..
You might want to take a look at android.widget.AdapterView and android.widget.Gallery: These are standard Android widgets that provide scrolling through images. However, this will not look like the UI you describe (iOS look&feel) but like an Android app...
See this example code:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Gallery1.html

Categories

Resources