Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / How to set image as background?

Author
Message
2D Analyst
AGK Developer
20
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 16th Oct 2012 02:04
I have a 480x800 picture that I want to use as background. Is there a command to use to set it as background? The background will not have any interaction with any objects.
MarcoBruti
13
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 16th Oct 2012 11:52
the only way I know and use is to create a sprite with an image that takes all the screen, resize the sprite to your virtual resolution/percentage , set a very high depth value, let's say 10000, (in order all other sprites are not hidden), and place at (0,0) position.
Very easy, maybe trivial, but I do not know any other alternative. In my apps, this approach works well.
2D Analyst
AGK Developer
20
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 16th Oct 2012 21:35
I've used the below code for it, which was in one of the game example.

Anyone know if this is the best approach to create background or is there a better way?

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Oct 2012 15:57
No need to render(), as that will be taken care of with the next sync().

And created sprites start at 0,0 so no need to position the sprite.

But... Sprites are created with the same size as the loaded image, so setting sprite size to match your screen size is a good idea.

Login to post a reply

Server time is: 2024-11-23 15:19:29
Your offset time is: 2024-11-23 15:19:29