Newbie: Background image loading

enonod

Well-Known Member
Licensed User
Longtime User
Question 1...
I have just loaded an image to form a background for adding sprites. I am following the sprite example and modifying it to learn the syntax etc.
I have a background that will appear in the centre of the screen only but cannot find any X,Y to position it. and the smaller (than screen size) image seems to fill the screen.
Do I have to treat the image as a sprite in order to position it?
Or
Do I have to produce a larger image with blank areas?

Question 2...
I notice the loading of sprites uses Sprite.new1 -Spr1.new1 -Spr2.new1.
I am not quite understanding where these names came from or rather were declared, I'm assuming they are names like fred.New1.

A little guidance here should get me going. Thank you.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Drawing an image on the background should be done with GameWindow.DrawBackgroundImage.
The image will stretch to fit the GameWindow size. So you should produce a larger image with blank areas.
Another solution is to treat the background image as a sprite.
2. Spr1 and Spr2 are Sprite objects added from the Tools menu: Tools - Add Object.
You could see the complete list of objects in the right pane (on the desktop).
I recommend you to read the GPS tutorial as it explains this topic:http://www.b4x.com/forum/showthread.php?t=1093
 

enonod

Well-Known Member
Licensed User
Longtime User
Thank you Erel, I'll read that now. That was quick, as if you were just waiting.
 
Top