Please carefully read this guide in order to fully configure this template, and remember to test it on a Real Device – the Emulator may fail.
This template has native Android Java/XML code so you can edit it only with Android Studio. If you don’t have it, download it for free.
Download Android Studiostring.xml
file – it’s into the res/values
folder in Android Studio – and replace the App Name of this line with your new one:
<string> string name="app_name"> Opposite </string>
com
folder as it is and rename the other ones.build.gradle
(the Module app one) in Android Studio and rename the applicationId
into your new package name, then click Sync Now on the top-right corner.
.xml
files stored into the res/layout
folder. Those files are the ones where you can edit all Views, Buttons texts, TextView’s strings, and all Views attributes – position, font color, size, etc.
.java
files.
drawable
folders, where the app icons are stored into the mipmap
folders.
res/values
folder in Android Studio. Open this file and keep reading this guide, you’ll have to perform some edits in this file in order to get your template ready to run.
<string> string name="app_name"> Opposite </string>
<string>name="ADMOB_INTERSTITIAL_UNIT_ID">ca-app-pub-3940256099942544/1033173712
<string>name="ADMOB_APP_ID">ca-app-pub-3940256099942544~3347511713
You have to create your Unit ID at apps.admob.comcolors.xml
file – you can find it into the res/values folder. The main color of the app and some other Views will be affected by your change:
<color name="top_color">#8FDAF4</color>
<color name="bottom_color">#48CFAE</color>
<color name="yellow_color">#F6D55C</color>
public static Typeface futuraBold;
These fonts are initialized into the onCreate()
function as follows:
futuraBold = Typeface.createFromAsset(getAssets(),"font/Futura-Bold.otf");
In case you want to add a new font, you have to first drag your .ttf
or .otf
font file into the app/src/main/assets/font
folder.public static Typeface
line that’s into the onCreate()
function – let’s pretend you have a font file called Helvetica-Bold.ttf, you may add an instance called hBold
(it’s just an example, name it as you wish since it’s a variable):
public static Typeface popBold, popSemibold, ... hBold;
Lastly, import its path into the onCreate()
function like the existing ones. Based on the font example above, your new line of code may look like this:
hBold = Typeface.createFromAsset(getAssets(),"font/helvetica-Bold.ttf");
public static String[] ENWords = {
"'MOISTURE'-DRY-WET",
"'TEMPERATURE'-HOT-COLD",
"'STATES OF DAY'-DAY-NIGHT",
"'DIRECTIONS'-ABOVE-BELOW",
"'GOOD AND BAD'-ANGEL-DEVIL",
"'AGES'-ADULT-CHILD",
"'CONDITION OF LIFE'-ALIVE-DEAD",
"'QUANTITY'-ALL-NONE",
"'DAY AND NIGHT'-SUN-MOON",
"'THINGS HAPPEN'-ALWAYS-NEVER",
"'COLORS'-BLACK-WHITE",
"'SEASONS'-WINTER-SUMMER",
"'DIRECTIONS'-FRONT-BACK",
"'SOON OR LATER'-BEFORE-AFTER",
"'BETTER OR NOT'-BEST-WORST",
"'SIZE'-BIG-SMALL",
"'CUTTING'-SHARP-BLUNT",
"'STUFF CONDITION'-OLD-NEW",
// YOU CAN ADD WORDS HERE (THE NUMBER OF ITEMS OF THIS ARRAY MUST BE EQUAL TO THE OTHER ONES - PLEASE REFER TO THE DOCUMENTATION)
};
public static String[] ITWords = {
"'TEMPERATURA'-FREDDO-CALDO",
"'STATI DELLA GIORNATA'-GIORNO-NOTTE",
"'GIORNO E NOTTE'-SOLE-LUNA",
"'DIREZIONI'-SOPRA-SOTTO",
"'GENITORI' '-PADRE-MADRE",
"'PARTI DEL MONDO'-TERRA-CIELO",
"'VIVERE E...'-VIVO-MORTO",
"'QUANTITA' '-TUTTO-NIENTE",
"'COLORI'-BIANCO-NERO",
"'LE COSE ACCADONO'-SEMPRE-MAI",
"'CONDIZIONE DI UN OGGETTO'-VECCHIO-NUOVO",
"'DIREZIONI'-FRONTE-RETRO",
"'ARRIVARE IN TEMPO'-PRIMA-DOPO",
"'ALFA E OMEGA'-INIZIO-FINE",
"'PUO' DIVENTARE SOLIDO'-ACQUA-GHIACCIO",
"'ASPETTO FISICO'-BELLO-BRUTTO",
"'ESSERE UMANO'-ANIMA-CORPO",
"'CUTTING'-SHARP-BLUNT",
// YOU CAN ADD WORDS HERE (THE NUMBER OF ITEMS OF THIS ARRAY MUST BE EQUAL TO THE OTHER ONES - PLEASE REFER TO THE DOCUMENTATION)
};
You may notice that each of the above arrays names is made by the first 2 language code digits (EN for English, IT for Italian).ENWords
arrayITWords
arrayGEWords
and edit all its items into the words and hints you want for the German language public static String[] ENAlphabet = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
public static String[] ITAlphabet = {"A","B","C","D","E","F","G","H","I","L","M","N","O","P","Q","R","S","T","U","V","Z"};
In this case, copy the ENAlphabet
array and paste it below the ITAlphabet
one, name it GEAlphabet and set all the characters of the alphabet of that language. here’s an example of how it should look:
public static String[] GEAlphabet = { "A","B","C", etc... };
Then you need to add your new language name into the following array:
public static String[] languagesArray = {
"English",
"Italiano",
};
So add “German”, right below “Italiano”.void setTextsIntoSelectedlanguage(String language)
function. // YOU CAN ADD TRANSLATIONS HERE - PLEASE REFER TO THE DOCUMENTATION
One last thing to do is to enter GameScreen.java and check the following code in the loadWords()
function:
// Set the array of words based on the selected language
switch (selectedLanguage){
case "English": alphabet = ENAlphabet; wordsArr = ENWords[lastLevel].split("-"); break;
case "Italiano": alphabet = ITAlphabet; wordsArr = ITWords[lastLevel].split("-"); break;
// YOU CAN ADD YOU CASES HERE IN CASE YO HAVE ADDED SOME MORE LANGUAGE (PLEASE REFER TO THE DOCUMENTATION)
default: break;
}
Below that comment, you must add a line like this (still considering the German language as an example):
case "German": alphabet = GEAlphabet; wordsArr = GEWords[lastLevel].split("-"); break;
PLEASE NOTE: Each item of the arrays is made by 3 words:
' '
because it’s a hint, and it’ll be shown on the top of the screen, below the LEVEL number.
-
symbol.
ENwords
array, you have to think about a hint and add a line like this:
"'TEMPERATURE'-HOT-COLD",
hint string
, you can type anything, anyway just make it short an clear, it must be a simple hint to help player to guess the 2 words 🙂
raw
– it’s inside the res
folder – which contains a few audio files, you may replace those sound clips with other files, just don’t rename them, name your new sound files like the existing ones and replace the existing ones with your new ones, so you won’t have to edit a single line of code.
showAdMobInterstitial
The Find in Path window will show you a list of files where that string is located.showAdMobInterstitial(ctx);