0

Here is a scenario on which i done a lot of research on google but hopeless. the scenario is, i am going to develop a 2D game in which i want to use multiple backgrounds and i want to translate them as they are moving forward, it must look like one background is near and translating/moving fast and the other background is a bit far and translating/moving a little slow. the nearer background have almost full intensity and the farer background have a bit low intensity. you can say they have different transparency levels. the question is, how can i get this task done or is this possible to use multiple backgrounds. any suggestion will be appreciated. as an example, see the image of BADLAND game bellow.

enter image description here

Mehran Khan
  • 80
  • 1
  • 10
  • you have to create several layouts or views above one another and set the background accordingly along with the alpha values – Rushi Ayyappa Dec 02 '16 at 07:19
  • If you want to create 2D games for Android, I strongly suggest you look into LibGDX (https://libgdx.badlogicgames.com) or similar game development framework. You will find soon enough that using native Android views and widgets (which are designed for apps, not games) will prevent you from doing a lot of typical game-oriented tasks and will lengthen your development process a ton. – Przemyslaw Jablonski Dec 02 '16 at 08:42
  • @RushiAyyappa Glad to have your kind suggestion. and i'll give it a try :) – Mehran Khan Dec 02 '16 at 14:36
  • @PrzemyslawJablonski thanks a ton man, your suggestion is informative and considerable. – Mehran Khan Dec 02 '16 at 14:37

1 Answers1

1

I think as far as I got your question you want to put two or more images one over another. I mean if you are trying to overlap the multiple backgrounds and asking for it yes it can be done easily.

What you need to do is to use the FrameLayout. as

"FrameLayout represents a simple layout for the user interface of Android applications. It is usually used for displaying single Views at a specific area on the screen or overlapping its child views."

and then you can implements the animations on them and translate them You can find different types of translation over them.

Here is all about using the frame layout frameLayout1 framelayout2 and for animations and translation here are links. link , link2 , link3

Community
  • 1
  • 1
A.s.ALI
  • 1,992
  • 3
  • 22
  • 54
  • Thanks a lot for your kind suggestion, i'll be back soon after making a try on these suggestion. i hope i'll get my work done with this :) – Mehran Khan Dec 02 '16 at 14:40