Game apps for smartphones and tablets

Research project PHBern  
HomeStart online editorAndroid TurtlegraphicsPrintJava-Online

Using your own sprites

Sprite images are used in order to display actors and backgrounds. Basically, there are three possibilities to include sprites:

1. Sprites from the image library of our webserver
All sprites that can be found in our learning program are saved on our webserver and can be used directly. When the name of the sprite is entered in the program code in quotation marks and without any extension, the image is searched in the program execution on our webserver.
When downloading apk, these sprites are packed in the apk file.

 

2. Sprites from the SD card
Some images can be saved in a subdirectory on the SD card of the smartphone or on the virtual SD card of the emulator. The name of the sprite has to be indicated in quotation marks with the name of the subdirectory and the extension. You can find the instructions to save the images on the SC card in the lower part of this website.

 

 

3. Sprites from the internet
This model presumes that you are online with your smartphone during the execution of the program. You can get the web address by clicking on the image with the right mouse button and by choosing Grafik Adresse kopieren with the right mouse button in the context menu.

 

 

To point 2) Saving the sprites on the SD card

In order to simplify copying the images from the computer to the SD card, we offer two applications in the online editor:

This virtual SD card is already set up with the installation of the emulator with our tools and is visible as sdcard.img in the home index of the user.  

Procedure:

1. Preparing your own sprites
Usually, sprite images for actors are relatively small (40x40 pixel), are saved in GIF-, or PNG format and have a transparent background. The background sprites can as well use JPEG format. Our background images have the size of approximately 400x400 pixel. Don't use any capital letters, gaps or special characters for the names of the images.

Save your sprites first in a folder on your hard disk. (e.g. sprites)  

2a. Copying sprites via USB onto SD card
Connect the smartphone to the USB cable or start the emulator.

Start copying the sprites by clicking on via USB .

A file manager window appears, where you can select the prepared folder sprites.

Afterwards, click open.

 

The images always have to be present in a subdirecotry, even if you'd like to copy individual images onto the SD card.

 

  If such a dialogue box appears, the images have been copied successfully onto the SD card and can be used in the program. If it doesn't work, try again the last step.

 

2b. Copying sprites via Bluetooth onto SD card

Installing SpriteTransfer app for Bluetooth sprite download on the smartphone:

SpriteTransfer app is a Bluetooth server that runs on smartphones and copies sprite files which were sent from the computer via Bluetooth onto the index of the SD card. This app was developed by our team and is signed with University of Berne, Switzerland. Before downloading the first sprite, you have to install this app via Bluetooth on your smartphone.

 

 

Install the SpriteTransfer App with the aid of the QR code

or download the SpriteTransfer app onto your Computer (Download) and install it manually.

 

 

 

 
QR code for the direct download to a smartphone

 

Start the SpriteTransfer app on your smartphone.

Start copying the sprites with a click on copy via Bluetooth.

A file manager window appears, in which you can select the prepared folder sprites.

Afterwards, click open.

 

 

 

3. Indicate the name of the sprite in the quotation marks with the name of the subdirectory and the extension