diff --git a/docs/InfoSTI/Infos-IST.pdf b/docs/InfoSTI/Infos-IST.pdf new file mode 100644 index 0000000..9dc758b Binary files /dev/null and b/docs/InfoSTI/Infos-IST.pdf differ diff --git a/docs/InfoSTI/Situations_Risques_ou_pas.jpg b/docs/InfoSTI/Situations_Risques_ou_pas.jpg new file mode 100644 index 0000000..82ab5e4 Binary files /dev/null and b/docs/InfoSTI/Situations_Risques_ou_pas.jpg differ diff --git a/docs/InfoSTI/leafletIST_2019_web_planches.pdf b/docs/InfoSTI/leafletIST_2019_web_planches.pdf new file mode 100644 index 0000000..906c893 Binary files /dev/null and b/docs/InfoSTI/leafletIST_2019_web_planches.pdf differ diff --git a/kapotopia/android/assets/EcranMenu/MenuPrincipalBoutons_cut.png b/kapotopia/android/assets/EcranMenu/MenuPrincipalBoutons_cut.png new file mode 100644 index 0000000..5491e07 Binary files /dev/null and b/kapotopia/android/assets/EcranMenu/MenuPrincipalBoutons_cut.png differ diff --git a/kapotopia/android/assets/EcranMenu/MenuPrincipalBoutons_cutdqsd.png b/kapotopia/android/assets/EcranMenu/MenuPrincipalBoutons_cutdqsd.png new file mode 100644 index 0000000..975a6bb Binary files /dev/null and b/kapotopia/android/assets/EcranMenu/MenuPrincipalBoutons_cutdqsd.png differ diff --git a/kapotopia/android/assets/EcranMenu/MenuPrincipalCadre1_cut.png b/kapotopia/android/assets/EcranMenu/MenuPrincipalCadre1_cut.png new file mode 100644 index 0000000..6395d2b Binary files /dev/null and b/kapotopia/android/assets/EcranMenu/MenuPrincipalCadre1_cut.png differ diff --git a/kapotopia/android/assets/EcranMenu/MenuPrincipalCadre3_cut.png b/kapotopia/android/assets/EcranMenu/MenuPrincipalCadre3_cut.png new file mode 100644 index 0000000..4df72c0 Binary files /dev/null and b/kapotopia/android/assets/EcranMenu/MenuPrincipalCadre3_cut.png differ diff --git a/kapotopia/android/assets/EcranMenu/World1EcranMenuCadre1_cut.png b/kapotopia/android/assets/EcranMenu/World1EcranMenuCadre1_cut.png new file mode 100644 index 0000000..d961cf1 Binary files /dev/null and b/kapotopia/android/assets/EcranMenu/World1EcranMenuCadre1_cut.png differ diff --git a/kapotopia/android/assets/EcranMenu/World1EcranMenuCadre2_cut.png b/kapotopia/android/assets/EcranMenu/World1EcranMenuCadre2_cut.png new file mode 100644 index 0000000..81c2a85 Binary files /dev/null and b/kapotopia/android/assets/EcranMenu/World1EcranMenuCadre2_cut.png differ diff --git a/kapotopia/android/assets/EcranMenu/mainmenu2_bis.png b/kapotopia/android/assets/EcranMenu/mainmenu2_bis.png new file mode 100644 index 0000000..a551c76 Binary files /dev/null and b/kapotopia/android/assets/EcranMenu/mainmenu2_bis.png differ diff --git a/kapotopia/android/assets/ISTback/dqsdq.png b/kapotopia/android/assets/ISTback/dqsdq.png new file mode 100644 index 0000000..8d7ca37 Binary files /dev/null and b/kapotopia/android/assets/ISTback/dqsdq.png differ diff --git a/kapotopia/android/assets/ISTback/dqsdqs.png b/kapotopia/android/assets/ISTback/dqsdqs.png new file mode 100644 index 0000000..e43f70a Binary files /dev/null and b/kapotopia/android/assets/ISTback/dqsdqs.png differ diff --git a/kapotopia/android/assets/ISTback/paleBlue.png b/kapotopia/android/assets/ISTback/paleBlue.png new file mode 100644 index 0000000..a2ca5f5 Binary files /dev/null and b/kapotopia/android/assets/ISTback/paleBlue.png differ diff --git a/kapotopia/android/assets/ISTback/yellow.png b/kapotopia/android/assets/ISTback/yellow.png new file mode 100644 index 0000000..70079be Binary files /dev/null and b/kapotopia/android/assets/ISTback/yellow.png differ diff --git a/kapotopia/android/assets/World1/Game1/Failed.png b/kapotopia/android/assets/World1/Game1/Failed.png new file mode 100644 index 0000000..7574d02 Binary files /dev/null and b/kapotopia/android/assets/World1/Game1/Failed.png differ diff --git a/kapotopia/android/assets/close.png b/kapotopia/android/assets/close.png new file mode 100644 index 0000000..d7af93b Binary files /dev/null and b/kapotopia/android/assets/close.png differ diff --git a/kapotopia/android/assets/game3/intro/Monde2Ecran1_cut.png b/kapotopia/android/assets/game3/intro/Monde2Ecran1_cut.png new file mode 100644 index 0000000..595ba69 Binary files /dev/null and b/kapotopia/android/assets/game3/intro/Monde2Ecran1_cut.png differ diff --git a/kapotopia/android/assets/game4/DigueDentaire.png b/kapotopia/android/assets/game4/DigueDentaire.png new file mode 100644 index 0000000..754318a Binary files /dev/null and b/kapotopia/android/assets/game4/DigueDentaire.png differ diff --git a/kapotopia/android/assets/game4/Embrassade.png b/kapotopia/android/assets/game4/Embrassade.png new file mode 100644 index 0000000..3de1d23 Binary files /dev/null and b/kapotopia/android/assets/game4/Embrassade.png differ diff --git a/kapotopia/android/assets/game4/ISTChoice.png b/kapotopia/android/assets/game4/ISTChoice.png new file mode 100644 index 0000000..3409a98 Binary files /dev/null and b/kapotopia/android/assets/game4/ISTChoice.png differ diff --git a/kapotopia/android/assets/game4/Mireille.png b/kapotopia/android/assets/game4/Mireille.png new file mode 100644 index 0000000..718e6f7 Binary files /dev/null and b/kapotopia/android/assets/game4/Mireille.png differ diff --git a/kapotopia/android/assets/game4/annulingus.png b/kapotopia/android/assets/game4/annulingus.png new file mode 100644 index 0000000..b20150c Binary files /dev/null and b/kapotopia/android/assets/game4/annulingus.png differ diff --git a/kapotopia/android/assets/game4/background_discussion.png b/kapotopia/android/assets/game4/background_discussion.png new file mode 100644 index 0000000..660d6bb Binary files /dev/null and b/kapotopia/android/assets/game4/background_discussion.png differ diff --git a/kapotopia/android/assets/game4/background_game.png b/kapotopia/android/assets/game4/background_game.png new file mode 100644 index 0000000..cd800b5 Binary files /dev/null and b/kapotopia/android/assets/game4/background_game.png differ diff --git a/kapotopia/android/assets/game4/blue_square.png b/kapotopia/android/assets/game4/blue_square.png new file mode 100644 index 0000000..812e6a3 Binary files /dev/null and b/kapotopia/android/assets/game4/blue_square.png differ diff --git a/kapotopia/android/assets/game4/caresses.png b/kapotopia/android/assets/game4/caresses.png new file mode 100644 index 0000000..206f607 Binary files /dev/null and b/kapotopia/android/assets/game4/caresses.png differ diff --git a/kapotopia/android/assets/game4/cunni.png b/kapotopia/android/assets/game4/cunni.png new file mode 100644 index 0000000..74cdf79 Binary files /dev/null and b/kapotopia/android/assets/game4/cunni.png differ diff --git a/kapotopia/android/assets/game4/down_arrow.png b/kapotopia/android/assets/game4/down_arrow.png new file mode 100644 index 0000000..d46e806 Binary files /dev/null and b/kapotopia/android/assets/game4/down_arrow.png differ diff --git a/kapotopia/android/assets/game4/echange_seringue.png b/kapotopia/android/assets/game4/echange_seringue.png new file mode 100644 index 0000000..e8825dc Binary files /dev/null and b/kapotopia/android/assets/game4/echange_seringue.png differ diff --git a/kapotopia/android/assets/game4/fellation.png b/kapotopia/android/assets/game4/fellation.png new file mode 100644 index 0000000..8197bd3 Binary files /dev/null and b/kapotopia/android/assets/game4/fellation.png differ diff --git a/kapotopia/android/assets/game4/game_cover.png b/kapotopia/android/assets/game4/game_cover.png new file mode 100644 index 0000000..188e8f4 Binary files /dev/null and b/kapotopia/android/assets/game4/game_cover.png differ diff --git a/kapotopia/android/assets/game4/gant.png b/kapotopia/android/assets/game4/gant.png new file mode 100644 index 0000000..88786b8 Binary files /dev/null and b/kapotopia/android/assets/game4/gant.png differ diff --git a/kapotopia/android/assets/game4/green_square.png b/kapotopia/android/assets/game4/green_square.png new file mode 100644 index 0000000..f0563e8 Binary files /dev/null and b/kapotopia/android/assets/game4/green_square.png differ diff --git a/kapotopia/android/assets/game4/left_arrow.png b/kapotopia/android/assets/game4/left_arrow.png new file mode 100644 index 0000000..009426f Binary files /dev/null and b/kapotopia/android/assets/game4/left_arrow.png differ diff --git a/kapotopia/android/assets/game4/legend_en.png b/kapotopia/android/assets/game4/legend_en.png new file mode 100644 index 0000000..d3f69b2 Binary files /dev/null and b/kapotopia/android/assets/game4/legend_en.png differ diff --git a/kapotopia/android/assets/game4/legend_fr.png b/kapotopia/android/assets/game4/legend_fr.png new file mode 100644 index 0000000..4b90e74 Binary files /dev/null and b/kapotopia/android/assets/game4/legend_fr.png differ diff --git a/kapotopia/android/assets/game4/pause_logo.png b/kapotopia/android/assets/game4/pause_logo.png new file mode 100644 index 0000000..8f90a8c Binary files /dev/null and b/kapotopia/android/assets/game4/pause_logo.png differ diff --git a/kapotopia/android/assets/game4/pene_anale.png b/kapotopia/android/assets/game4/pene_anale.png new file mode 100644 index 0000000..22a3fb3 Binary files /dev/null and b/kapotopia/android/assets/game4/pene_anale.png differ diff --git a/kapotopia/android/assets/game4/pene_vaginal.png b/kapotopia/android/assets/game4/pene_vaginal.png new file mode 100644 index 0000000..3e8bc41 Binary files /dev/null and b/kapotopia/android/assets/game4/pene_vaginal.png differ diff --git a/kapotopia/android/assets/game4/play_logo.png b/kapotopia/android/assets/game4/play_logo.png new file mode 100644 index 0000000..423b088 Binary files /dev/null and b/kapotopia/android/assets/game4/play_logo.png differ diff --git a/kapotopia/android/assets/game4/red_square.png b/kapotopia/android/assets/game4/red_square.png new file mode 100644 index 0000000..f6c1ae1 Binary files /dev/null and b/kapotopia/android/assets/game4/red_square.png differ diff --git a/kapotopia/android/assets/game4/right_arrow.png b/kapotopia/android/assets/game4/right_arrow.png new file mode 100644 index 0000000..e21467e Binary files /dev/null and b/kapotopia/android/assets/game4/right_arrow.png differ diff --git a/kapotopia/android/assets/game4/up_arrow.png b/kapotopia/android/assets/game4/up_arrow.png new file mode 100644 index 0000000..3a19b5d Binary files /dev/null and b/kapotopia/android/assets/game4/up_arrow.png differ diff --git a/kapotopia/android/assets/strings/strings.properties b/kapotopia/android/assets/strings/strings.properties index 60bcc8d..a79db82 100644 --- a/kapotopia/android/assets/strings/strings.properties +++ b/kapotopia/android/assets/strings/strings.properties @@ -4,6 +4,8 @@ text_world3=World 3 text_world4=World 4 game1_button=Infectious Jungle game2_button=Basket Beach +game3_button=God'iva Show +game4_button=Sssneaky text_istdex=ISTdex # Choosing Difficulty Screen easy_button=Easy @@ -17,11 +19,16 @@ play_button=Play back_button=Back back_menu_button=Back to menu next_button=Next +previous_button=Previous quit_button_text=Quit skip_button=Skip continue_button=Continue restart_button=Restart +cancel_button=Cancel +exit_button=Exit +legend_button=Legend +congrats_msg=Congratulations ! success=Bravo ! fail=GAME OVER pause_label_text=Pause @@ -36,7 +43,7 @@ question_button=Question score2_label=Score : timer_label=Timer : lives_label=Lifes : -istattrapees=STIs catched: +istattrapees=STI catched: highscore=Highscore: time_left=Time left : your_score_is=Your score is : @@ -46,16 +53,16 @@ dialogIntro1=Welcome to Kapotopia ! dialogIntro2=Here, you'll learn important informations on sexuality and its risks in order to better protect yourself. dialogIntro3=The first world contains two tests about your knowledge on STI : their names and symptoms.\nThe second world will teach you the safe and unsafe sexual practices.\nAnd finally the STI-dex, it is simply an encyclopedia to learn everything about our ennemies, the STIs. # Intro Game 1 -dialogG1_1=Hi ! I was waiting for you ! I'm mireille, your condom-pal. +dialogG1_1=Hi ! I was waiting for you ! I'm Mireille, your condom-pal. dialogG1_2=If you're here, it's because like me, you have to redo your exams.\nThis year, the tests are done in pairs. I'm counting on you to help me succeed ! dialogG1_3=As you're new here, i hope the trials won't be to hard for you. The instructors tend to be a bit blunt... dialogG1_4=Oh speak of the devil, watch out, Sergeant Dildo's coming, we'd better shut up before we get put into the hole. -dialogG1_5=Greetings, recruits. Welcome to the Infectious Jungle of Chilly Beachy! Here, you will show me your skills to identify our longtime enemies: the terrible STIs! -dialogG1_6=Let's not beat around the bush, let's go for a warm-up: a little jog in the infectious jungle.\nBeware of the ists wandering around in the jungle, don't let any escape! +dialogG1_5=Greetings, recruits. Welcome to the Infectious Jungle of Chilly Beachy! Here, you will show me your skills to identify our longtime enemies: the terrible STI! +dialogG1_6=Let's not beat around the bush, let's go for a warm-up: a little jog in the infectious jungle.\nBeware of the STI wandering around in the jungle, don't let any escape! dialogG1_7=Okay bidet bottom scrapers, show me what you got! -dialogG1_rules_1=Your goal here is to quickly identify real STIs and catch them before they hit the ground.\nMove Mireille around on the different roads in order to do that. You'll be rewarded for every STD you catch.\nWarning: not all creatures falling from trees are STIs! You're not empowered to catch them, so you'll lose a life if you do.\nAfter three lives lost, you start the adventure all over again.\n\nAnd if you find the warm-up too easy, you can always try the higher difficulty. +dialogG1_rules_1=Your goal here is to quickly identify real STI and catch them before they hit the ground.\nMove Mireille around on the different roads in order to do that. You'll be rewarded for every STI you catch.\nWarning: not all creatures falling from trees are STI! You're not empowered to catch them, so you'll lose a life if you do.\nAfter three lives lost, you start the adventure all over again.\n\nAnd if you find the warm-up too easy, you can always try the higher difficulty. # Game 1 -intro_text=Well done! Unfortunately, you forgot to catch the following STIs: +intro_text=Well done! Unfortunately, you forgot to catch the following STI: game1_outro1=Well, it wasn't easy, but I passed the first test thanks to you. Let's go to the next one, to the beach this time! # Intro Game 2 game2_diag1=Warm sand, sunny sky, seagulls flying around, man-eating sharks, no doubt we are at the beach! @@ -71,18 +78,24 @@ game2_badending5=Nice try! game2_badending6=Persevere! You can do it. game2_goodending1=Congratulations! game2_goodending2=You've combined all the good ones -game2_goodending3=symptoms to the right STIs! +game2_goodending3=symptoms to the right STI! -game3_diag1=How dense this forest is, it's a real maze. +game3_diag1=I'm tired after all this sport, I won't say no to some drinks. game3_diag2=Oh, but is that a building I see over there? game3_diag3=This is my final test? What a strange place, I hope I didn't get lost, let's go in and check it out. game3_diag4=But, but... this place is infested with STIs! I got the wrong address! -game3_diag5=Hello, I'm Thomas GODIVA. Are you a condom?\nSTIs are my friends and we don't like your kind around here.\nYou'd better get out of here fast, we have pins to settle your score! +game3_diag5=Hello, I'm Thomas GODIVA. Are you a condom?\nSTI are my friends and we don't like your kind around here.\nYou'd better get out of here fast, we have pins to settle your score! game3_instr=Hurry, you must run, or you'll get pierced!\nThis door is electronically locked. To unlock it, rotate each cell of the maze to connect the battery to the right lock!\nEach lock is associated with a risky practice, or not, tap on it to display it.\n\nWarning: Only one lock works. You must find the non-hazardous practice, the others won't work! game3_win=Congratulations, you managed to escape! You've passed the last test! Yes, this was all staged, and Thomas Godiva was an assistant. The house apologizes for the scare. game3_win_tom=Bravo! Here, take a chocolate to comfort you, hoping it will help you for the next challenge. game3_loose=Unfortunately you didn't manage to get away... +game4_diag1=Finally, I was able to leave this weird place, but where am I? ... It looks like I'm at the back of the building ... +game4_diag2=But what's going on here? There are lots of STIs that keep spreading ! +game4_diag3=This is the territory of my STI friends! Everything that happens here helps them to propagate. See with your own eyes how it happens! +game4_rules=In this game you play as an STI. You have to recognize the risky practices that help you to spread.\nSelect the STI you are interested in, move with the arrows, collect the risky practices that help its transmission and avoid the protections as well as the practices that prevent the chosen STI from spreading.\n\nYou will be rewarded or penalized according to the practices you collect. +game4_choose=Choose your STI ! + rules_title=RULES q0_choix1=blanc @@ -98,14 +111,15 @@ q1_question=Mireille color ? # PRACTICES safe1=Getting a tattoo -safe2=Giving massages +safe2=Lonely masturbation safe3=Getting bitten\nby a mosquito safe4=Kissing someone -safe5=Play kapotopia +safe5=Play Kapotopia safe6=Sitting on a\npublic toilet board safe7=Drinking out of a stranger's glass safe8=Getting vaccinated safe9=Receiving\na blood transfusion +safe10=Spanish handjob unsafe1=A vaginal\npenetration unsafe2=An anal\npenetration @@ -120,6 +134,8 @@ unsafe10=A facial\nejaculation unsafe11=A finger\nin the vagina unsafe12=An ejaculation\non the genitals unsafe13=The 69 position +unsafe14=Withdraw before ejaculation +mistake_msg=But, you've made some mistakes: # SYMPTOMS hiv_symp=Often asymptomatic. In other cases, skin rashes and/or flu-like symptoms (fever, fatigue, swollen glands, etc.) in the first few weeks. @@ -163,20 +179,20 @@ conjonctivite_name=Conjunctivitis mycose_name=Mycosis # STI DESCRIPTIONS -gonorrhee_descr=Bacteria usually without symptoms. When present, there is discharge (penis or vagina), irritation and burning when urinating. It leads to sterility. -chlamydia_descr=Most often a bacteria without symptoms, it can be recognized by pain when urinating and irregular bleeding. It leads to serious infections and sterility. -herpes_descr=Virus causing pimples and very painful lesions during primary infection. It causes more or less frequent and important recurrences. -vih_descr=Virus most often without symptoms, sometimes with flu-like symptoms in the first few weeks. It causes multiple infections related to a drop in immunity. -papillomavirus_descr=Virus most often without symptoms, sometimes with precancerous lesions. It can cause genital warts and lesions that can develop into cancer. -syphilis_descr=Bacteria that can cause joint, cardiovascular and neurological complications. It is recognized from mouth, genital or anal cankers and skin rashes. -trichonomas_descr=Parasite causing odorous and colourful vaginal discharge. Symptom-free in 20% of cases at the vaginal level, 90% at the penis level. Greatly facilitates the appearance of other STIs. -hepatiteA_descr=Most often a virus without symptoms, it is naturally cured in the vast majority of cases. The others evolve into fulminant hepatitis (40% mortality). -hepatiteB_descr=Most often a virus with no symptoms, it can cause acute illness. In chronic cases, it causes liver disease, cirrhosis, cancer and death. -hepatiteC_descr=Most often a virus without symptoms, it is naturally curable in some cases, in chronic cases there is liver disease, cirrhosis, cancer and death. -chancremou_descr=A disease caused by Ducrey's bacile bacterium, it causes an ulcerated canker and swollen lymph nodes. -mycoplasmagenitalium_descr=An unusual bacterium in Belgium, it causes the appearance of other infectious diseases, in particular for the reproductive organs. -gale_descr=A skin disease caused by a parasite, it burrows into cavities below the surface of the skin, where it feeds and lays its eggs. Although not very serious, it is nonetheless highly contagious. -morpion_descr=A parasitic insect that specifically targets pubic hair. It causes strong discomfort and its bites promote infection from other STIs. +gonorrhee_descr=Bacteria usually without symptoms. When present, there is discharge (penis or vagina), irritation and burning when urinating. It leads to sterility. You can protect yourself with an external or internal condom or a latex pad if you have oral sex. It is advisable to be screened regularly. It consists of a vaginal, anal or throat smear and/or a urine sample. +chlamydia_descr=Most often a bacteria without symptoms, it can be recognized by pain when urinating and irregular bleeding. It leads to serious infections and sterility. You can protect yourself with an external or internal condom or a latex pad if you have oral sex. It is advisable to be screened regularly. It consists of a vaginal, anal or throat smear and/or a urine sample. +herpes_descr=Virus causing pimples and very painful lesions during primary infection. It causes more or less frequent and important recurrences. Condoms and latex squares can provide partial protection, but the lesions should not be touched. Testing requires a medical examination. It is worn for life once infected. +vih_descr=Virus most often without symptoms, sometimes with flu-like symptoms in the first few weeks. It causes multiple infections related to a drop in immunity. You can protect yourself with an external or internal condom or a latex pad, and you must avoid contact between contaminating liquids, open wounds, or mucous membranes. Screening is done through a blood test. +papillomavirus_descr=Virus most often without symptoms, sometimes with precancerous lesions. It can cause genital warts and lesions that can develop into cancer. Vaccination is recommended for all women, a condom and a latex pad can reduce the risk but are not sufficient. Screening is done by a medical examination or a smear test. An examination every 3 years is recommended. +syphilis_descr=Bacteria that can cause joint, cardiovascular and neurological complications. It is recognized from mouth, genital or anal cankers and skin rashes. If the chancre is on the genitals, you can protect yourself with a condom. Testing is done with a blood test and a clinical examination. +trichonomas_descr=Parasite causing odorous and colourful vaginal discharge. Symptom-free in 20% of cases at the vaginal level, 90% at the penis level. Greatly facilitates the appearance of other STIs. You can protect yourself with an external or internal condom. Screening is done through a vaginal or urethral smear. Treatment is based on antibiotics. +hepatiteA_descr=Most often a virus without symptoms, it is naturally cured in the vast majority of cases. The others evolve into fulminant hepatitis (40% mortality). A vaccine is available. Contact of the mouth with faeces should be avoided. Therefore, use a latex square in case of anilingus. Screening is done through a blood test. +hepatiteB_descr=Most often a virus with no symptoms, it can cause acute illness. In chronic cases, it causes liver disease, cirrhosis, cancer and death. A vaccine is available. Contact with feces should be avoided, so use a condom or a latex condom if you have oral sex. Screening is done through a blood test. There is an oral treatment. +hepatiteC_descr=Most often a virus without symptoms, it is naturally curable in some cases, in chronic cases there is liver disease, cirrhosis, cancer and death. It is protected by an external or internal condom or a latex patch. Screening via blood test and TROD. An antiviral treatment is available. +chancremou_descr=A disease caused by Ducrey's bacile bacterium, it causes an ulcerated canker and swollen lymph nodes. Condoms reduce the risk of transmission. Screening should include a clinical examination. +mycoplasmagenitalium_descr=An unusual bacterium in Belgium, it causes the appearance of other infectious diseases, in particular for the reproductive organs. You can protect yourself by using condoms. Screening is done through a vaginal, anal and throat swab or a urine test. +gale_descr=A skin disease caused by a parasite, it burrows into cavities below the surface of the skin, where it feeds and lays its eggs. Although not very serious, it is nonetheless highly contagious. Avoiding prolonged contact with an infected person or his or her clothing is necessary to protect yourself. Scabies is detected during a medical examination. +morpion_descr=A parasitic insect that specifically targets pubic hair. It causes strong discomfort and its bites promote infection from other STIs. Shaving the pubic hair prevents the development of crabs. Their presence is determined by medical examination or self-examination. alternariose_descr=A series of fungal diseases that cause burns to certain types of plants, such as sunflowers, tomatoes and carrots. It can be considered a plant-related STI. #TODO change the name of this fake ist to make a joke with the english surname of Gonorrhea (which is the clap) froidepisse_descr=The clap is synonymous with gonorrhea, however this one is an imaginary disease. diff --git a/kapotopia/android/assets/strings/strings_fr.properties b/kapotopia/android/assets/strings/strings_fr.properties index 632d6b8..4c938dc 100644 --- a/kapotopia/android/assets/strings/strings_fr.properties +++ b/kapotopia/android/assets/strings/strings_fr.properties @@ -2,8 +2,10 @@ text_world1=Chilly Beachy text_world2=Risky Club text_world3=Monde 3 text_world4=Monde 4 -game1_button=Jungle Infectueuse +game1_button=Jungle Infectieuse game2_button=Basket Beach +game3_button=God'iva Show +game4_button=Sssneaky text_istdex=ISTdex # Choosing Difficulty Screen easy_button=Facile @@ -17,11 +19,16 @@ play_button=Jouer back_button=Retour back_menu_button=Retour au menu next_button=Suivant +previous_button=Retour quit_button_text=Quitter skip_button=Passer continue_button=Continuer restart_button=Recommencer +cancel_button=Annuler +exit_button=Quitter +legend_button=Légende +congrats_msg=Félicitations ! success=Bravo ! fail=GAME OVER pause_label_text=Pause @@ -36,26 +43,26 @@ question_button=Question score2_label=Score : timer_label=Timer : lives_label=Vies : -istattrapees=ISTs attrapées: -highscore=Highscore: -time_left=Time left : +istattrapees=IST attrapées: +highscore=Record: +time_left=Temps restant : your_score_is=Ton score est : -high_score_lab_head=New +high_score_lab_head=Nouveau # Intro general dialogIntro1=Bienvenue à Kapotopia ! dialogIntro2=Ici, tu apprendras des informations importantes sur la sexualité et ses risques afin de mieux t'en protéger. dialogIntro3=Le premier monde contient deux épreuves pour tester tes connaissances à propos des IST : leur noms et leurs symptômes. \nLe deuxième monde t'apprendra les pratiques sexuelles à risques ou non.\nL'IST-dex, quant à lui, est simplement une encylopédie pour tout apprendre sur nos ennemis les IST. # Intro Game 1 -dialogG1_1=Bonjour toi, je t'attendais ! Je suis mireille, ta ca-pote. +dialogG1_1=Bonjour toi, je t'attendais ! Je suis Mireille, ta ca-pote. dialogG1_2=Si tu es ici, c'est que comme moi, tu as des examens à passer.\nCette année, les épreuves se font par deux. Je compte sur toi pour m'aider à réussir ! dialogG1_3=Vu que t'es nouveau, j'espère que les épreuves ne seront pas trop dures pour toi. Les instructeurs ont tendance à être un peu brusques... dialogG1_4=Oh en parlant du loup, attention le sergent Dildo s'approche, on ferait mieux de se taire avant de se faire mettre au trou. dialogG1_5=Salutation, recrues. Bienvenue dans la Jungle Infectieuse de Chilly Beachy! Ici, vous allez me montrer vos compétences pour identifier nos ennemis de toujours: les terribles IST ! -dialogG1_6=Ne tournons pas autour du pot, c'est parti pour l'échauffement : un petit footing dans la jungle infectieuse.\nPrenez garde aux ist qui se baladent dans la jungle, n'en laissez aucune s'échapper ! +dialogG1_6=Ne tournons pas autour du pot, c'est parti pour l'échauffement : un petit footing dans la jungle infectieuse.\nPrenez garde aux IST qui se baladent dans la jungle, n'en laissez aucune s'échapper ! dialogG1_7=Okay les raclures de fond de bidet, montrez-moi ce que vous avez dans le ventre ! dialogG1_rules_1=Ton but ici est d'identifier rapidement les vraies IST et de les attraper avant qu'elles ne touchent le sol.\nDéplace Mireille sur les différentes routes dans ce but. Tu seras récompensé pour chaque IST attrapée.\nAttention: toutes les créatures tombant des arbres ne sont pas des IST! Tu n'es pas habilité à les attraper, tu perdras donc une vie si tu le fais.\nAu bout de 3 vies perdues, tu recommences l'aventure.\n\nEt si tu trouves l'échauffement trop facile, tu peux toujours essayer la difficulté supérieure. # Game 1 -intro_text=Bien joué ! Malheureusement, tu as oublié d'attraper les ists suivantes : +intro_text=Bien joué ! Malheureusement, tu as oublié d'attraper les IST suivantes : game1_outro1=Eh beh, ce n'était pas facile, mais j'ai réussi la première épreuve grâce à toi. Passons maintenant à la suivante! # Intro Game 2 game2_diag1=Le sable chaud, un ciel ensoleillé, les mouettes qui virevoltent, des requins mangeurs d'homme, pas de doute nous sommes à la plage ! @@ -71,11 +78,11 @@ game2_badending5=Bien essayé! game2_badending6=Persévère! Tu peux y arriver. game2_goodending1=Félicitation! game2_goodending2=Tu as associé tous les bons -game2_goodending3=symptômes aux bonnes ISTs! +game2_goodending3=symptômes aux bonnes IST! # Game 3 -game3_diag1=Qu'est ce que cette forêt est dense, c'est un véritable labyrinthe. +game3_diag1=C'est épuisant tout ce sport, je boirais bien un petit coup. game3_diag2=Oh mais serait-ce un bâtiment que j'aperçois là-bas ? -game3_diag3=C'est ici ma dernière épreuve? Quel lieu étrange, j'espère que je ne me suis pas perdue, entrons pour vérifier. +game3_diag3=C'est ici ma dernière épreuve ? Quel lieu étrange, j'espère que je ne me suis pas perdue, entrons pour vérifier. game3_diag4=Mais, mais... ce lieu est infesté d'IST ! Je me suis trompée d'adresse! game3_diag5=Bonjour, je suis Thomas GODIVA. Tu es un préservatif?\nLes IST sont mes amies et nous n'aimons pas les gens dans ton genre par ici.\nTu ferais mieux de déguerpir rapidement, nous avons des épingles pour te régler ton compte! game3_instr=Vite, tu dois fuir, sinon tu te feras percer!\nCette porte est verrouillée électroniquement. Pour la déverrouiller, fais tourner chaque case du labyrinthe pour connecter la batterie à la bonne serrure!\nChaque serrure est associée à une pratique à risque, ou non, tapes-dessus pour l'afficher. \n\nAttention: Seule une serrure marche. Tu dois trouver la pratique non à risque, les autres ne fonctionneront pas! @@ -83,6 +90,12 @@ game3_win=Félicitation, tu as réussis à t'enfuir! Tu as donc réussis la dern game3_win_tom=Bravo ! Tiens, prends un chocolat pour te réconforter, en espérant que cela t'aides pour la prochaine épreuve. game3_loose=Malheureusement tu n'as pas réussi à t'enfuir... +game4_diag1=Oh j'ai pu quitter cet endroit bizarre, mais où suis-je ? ... On dirait que je suis à l'arrière du bâtiment ... +game4_diag2=Mais que se passe-t-il ici ? il y a plein d'IST qui n'arrêtent pas de se propager ! +game4_diag3=Ici c'est le territoire de mes amies les IST! Tout ce qui se passe ici favorise leur propagation. Observe de tes propre yeux comment ça se passe! +game4_rules=Dans ce jeu tu incarnes une IST. Tu dois reconnaître les pratiques à risque qui t'aide à te propager.\nSélectionne l'IST qui t'intéresse, déplace-toi à l'aide des flèches, récolte les pratiques à risque qui favorisent ta transmission et évite les protections ainsi que les pratiques ne permettant pas à l'IST choisie de se propager.\n\nTu seras récompensé ou pénalisé en fonction de la pratique récoltée. +game4_choose=Choisis ton IST ! + rules_title=REGLES q0_choix1=blanc @@ -98,7 +111,7 @@ q1_question=Mireille color ? # PRACTICES safe1=Se faire tatouer -safe2=Faire des\nmassages +safe2=Masturbation en solitaire safe3=Se faire piquer\npar un moustique safe4=Embrasser\nquelqu'un safe5=Jouer à kapotopia @@ -106,6 +119,7 @@ safe6=S'asseoir sur\nune planche de\ntoilette publique safe7=Boire dans\nle verre d'un inconnu safe8=Se faire\nvacciner safe9=Recevoir\nune transfusion sanguine +safe10=Une branlette \nespagnole unsafe1=Une pénétration\nvaginale unsafe2=Une pénétration\nanale @@ -120,16 +134,18 @@ unsafe10=Une éjaculation\nfaciale unsafe11=Un doigt\ndans le vagin unsafe12=Une éjaculation\nsur les organes\ngénitaux unsafe13=La position 69 +unsafe14=Se retirer \navant éjaculation +mistake_msg=Mais vous avez des erreurs: # SYMPTOMS -hiv_symp=Souvent asymptotique. Dans les autres cas, éruptions cutanées et/ou symptômes ressemblant à ceux de la grippe (fièvre, fatigue, ganglions gonflés, etc.) dans les premières semaines +hiv_symp=Souvent asymptomatique. Dans les autres cas, éruptions cutanées et/ou symptômes ressemblant à ceux de la grippe (fièvre, fatigue, ganglions gonflés, etc.) dans les premières semaines c_hepatitis_symp=Fièvre, jaunisse, nausée, douleurs musculaires, fatigue (2 à 4 semaines après contamination) -hpv_symp=Souvent asymptotique. Dans les autres cas, lésions précancéreuses très souvent indolores et/ou irritations, démangeaisons dues à l'apparition de verrues (appelées condylomes) -gonorrhea_symp=Écoulement inhabituel (du pénis ou du vagin), irritation du pénis ou de la vulve, douleurs dans le bas-ventre, sensation de brûlure en urinant, douleur à la gorge et à l'anus. -chlamydia_symp=Souvent asymptotique. Dans les autres cas, douleurs en urinant, au bas-ventre/à la gorge/à l'anus, écoulement inhabituel des parties génitales, saignements irréguliers. +hpv_symp=Souvent asymptomatique. Dans les autres cas, lésions précancéreuses très souvent indolores et/ou irritations, démangeaisons dues à l'apparition de verrues (appelées condylomes) +gonorrhea_symp=Ecoulement inhabituel (du pénis ou du vagin), irritation du pénis ou de la vulve, douleurs dans le bas-ventre, sensation de brûlure en urinant, douleur à la gorge et à l'anus. +chlamydia_symp=Souvent asymptomatique. Dans les autres cas, douleurs en urinant, au bas-ventre/à la gorge/à l'anus, écoulement inhabituel des parties génitales, saignements irréguliers. herpes_symp=Cloches sur les organes génitaux ou l'anus, douleur en urinant (Généralement 2 à 20 jours après contamination, parfois quelques années). Très douloureux lors de la primo-infection. syphillis_symp=Chancre (ulcère ou plaie creuse) buccal, génital ou anal au stade précoce (peut passer inaperçu) et éruption cutanée. -trichomonas_symp=Pertes vaginales odorantes et colorées, démangeaisons, sensation de brûlure en urinant. Symptômes fréquents au niveau vaginal (80% des cas) mais asymptotique dans 90% des cas au niveau du pénis. +trichomonas_symp=Pertes vaginales odorantes et colorées, démangeaisons, sensation de brûlure en urinant. Symptômes fréquents au niveau vaginal (80% des cas) mais asymptomatique dans 90% des cas au niveau du pénis. chancreMou_symp=Ulcération de la peau avec l'apparition de lésions multiples. Gonflement des ganglions lymphatiques. Généralement beaucoup plus douloureux pour un pénis que pour une vulve. mycoplasmaGenitalium_symp=Souvent asymptomatique. Pertes vaginales, saignements inter-menstruels ou post-coïtaux pour une vulve. Douleurs en urinant, écoulement, infection de l'urètre pour un pénis. @@ -163,24 +179,24 @@ conjonctivite_name=Conjonctivite mycose_name=Mycose # STI DESCRIPTIONS -gonorrhee_descr=Bactérie le plus souvent sans symptômes. Quand elle est présente, on observe des écoulements (pénis ou vagin), des irritations et des brûlures en urinant. Elle mène à la stérilité. -chlamydia_descr=Bactérie le plus souvent sans symptômes, elle se reconnait par des douleurs en urinant et des saignements irréguliers. Elle mène à des infections sérieuses et la stérilité. -herpes_descr=Virus causant des boutons et lésions très douloureuses lors de la primo-infection. Il provoque des récidives plus ou moins fréquentes et importantes. -vih_descr=Virus le plus souvent sans symptômes, avec parfois des symptômes grippaux lors des premières semaines. Il provoque des infections multiples liés à une baisse de l'immunité. -papillomavirus_descr=Virus le plus souvent sans symptômes, avec parfois des lésions précancéreuses. Il peut causer des verrues génitales et des lésions pouvant évoluer en cancer. -syphilis_descr=Bactérie pouvant causer des complications articulaires, cardiovasculaires et neurologiques. On la reconnait à cause de chancres buccaux, génital ou analet des éruptions cutanées. -trichonomas_descr=Parasite causant des pertes vaginales odorantes et colorées. Sans symptômes dans 20% des cas au niveau vaginal, 90% au niveau du pénis. Facilite largement l'apparition d'autres IST. -hepatiteA_descr=Virus le plus souvent sans symptôme, on en guérit naturellement dans la grande majorité des cas. Les autres évoluent en hépatites fulminantes (40% de mortalité). -hepatiteB_descr=Virus le plus souvent sans symptômes, il peut causer une affection aiguë. Dans les cas chronique, il cause une maladie du foie, cirrhose, cancer et décès. -hepatiteC_descr=Virus le plus souvent sans symptômes, elle se soigne naturellement dans une partie des cas, dans les cas chroniques, il y a maladie du foie, cirrhose, cancer et décès. -chancremou_descr=Maladie causée par la bactérie du bacile de Ducrey, il provoque un chancre ulcéré ainsi que des gonflements de ganglions lymphatiques -mycoplasmagenitalium_descr=Bactérie peu commune en Belgique, elle provoque l'apparition d'autres maladies infectieuses notamment pour les organes reproducteurs. -gale_descr=Maladie de la peau causée par un parasite, il creuse des cavités sous la surface de la peau, dont il se nourrit, et y pond ses œufs. Sans grande gravité, elle est néanmoins très contagieuse. -morpion_descr=Insecte parasite qui cible spécifiquement les poils du pubis. Il occasionne de fortes gênes et ses morsures favorisent les infections d'autres IST. +gonorrhee_descr=Bactérie en général sans symptôme. S'il y en a, on observe des écoulements (pénis ou vagin), des irritations et des brûlures en urinant. Elle mène à la stérilité. On peut s'en protéger grâce à un préservatif externe ou interne ou un carré de latex en cas de pratique oral. Il est conseillé de se faire dépister régulièrement. Il consiste en un frottis vaginal, anal ou gorge et/ou un prélèvement urinaire. +chlamydia_descr=Bactérie en général sans symptôme, elle se reconnait par des douleurs en urinant et des saignements irréguliers. Elle mène à des infections sérieuses et à la stérilité. On peut s'en protéger grâce à un préservatif externe ou interne ou un carré de latex en cas de pratique oral. Il est conseillé de se faire dépister régulièrement. Il consiste en un frottis vaginal, anal ou gorge et/ou un prélèvement urinaire. +herpes_descr=Virus causant des boutons et lésions très douloureuses lors de la primo-infection. Il provoque des récidives plus ou moins fréquentes et importantes. Les préservatifs et carrés de latex permettent de s'en protéger partiellement, il faut éviter de toucher les lésions. Le dépistage nécessite un examen médicale. On le porte à vie une fois infecté. +vih_descr=Virus le plus souvent sans symptôme, avec parfois des symptômes grippaux lors des premières semaines. Il provoque des infections multiples liées à une baisse de l'immunité. On peut s'en protéger grâce à un préservatif externe ou interne ou un carré de latex, il faut éviter le contact entre liquide contaminant, plaie ouverte, ou muqueuses. Le dépistage se fait via une prise de sang et un test rapide. +papillomavirus_descr=Virus le plus souvent sans symptôme, avec parfois des lésions précancéreuses. Il peut causer des verrues génitales et des lésions pouvant évoluer en cancer. Le vaccin est conseillé à toutes, un préservatif et un carré de latex permmettent de réduire les risques mais ne sont pas suffisant. Le dépistage se fait par un examen médical ou un frottis. Un examen tous les 3 ans est conseillé. +syphilis_descr=Bactérie pouvant causer des complications articulaires, cardiovasculaires et neurologiques. On la reconnait à cause de chancres buccaux, génital ou anal et des éruptions cutanées. Si le chancre se trouve sur les parties génitals on peut s'en protéger avec un préservatif. Le dépistage se fait avec une prise de sang et un examen clinique. +trichonomas_descr=Parasite causant des pertes vaginales odorantes et colorées. Sans symptômes dans 20% des cas au niveau vaginal, 90% au niveau du pénis. Facilite largement l'apparition d'autres IST. On peut s'en protéger grâce à un préservatif externe ou interne. Le dépistage se fait via un frottis vaginal ou de l'urêtre. Le traitement est à base d'antibiotique. +hepatiteA_descr=Virus le plus souvent sans symptôme, on en guérit naturellement dans la grande majorité des cas. Les autres évoluent en hépatites fulminantes (40% de mortalité). Il existe un vaccin. Il faut éviter le contact de la bouche avec des matières fécales. Donc utiliser un carré de latex en cas d'anulingus. Le dépistage est fait via une prise de sang. +hepatiteB_descr=Virus le plus souvent sans symptôme, il peut causer une affection aiguë. Dans les cas chronique, il cause une maladie du foie, cirrhose, cancer et décès. Il existe un vaccin. Il faut éviter le contact avec les matières fécales donc utiliser un préservatif ou un carré de latex en cas de pratique oral. Le dépistage est fait via une prise de sang. Il existe un traitement par prise oral. +hepatiteC_descr=Virus le plus souvent sans symptôme, elle se soigne naturellement dans une partie des cas, dans les cas chroniques, il y a maladie du foie, cirrhose, cancer et décès. On s'en protège grâce à un préservatif externe ou interne ou un carré de latex. Dépisatge via prise de sang et TROD. Un traitement à base d'antivirus existe. +chancremou_descr=Maladie causée par la bactérie du bacile de Ducrey, il provoque un chancre ulcéré ainsi que des gonflements de ganglions lymphatiques. Les préservatifs réduisent les risques de transmissions. Le dépistage doit passer par un examen clinique. +mycoplasmagenitalium_descr=Bactérie peu commune en Belgique, elle provoque l'apparition d'autres maladies infectieuses notamment pour les organes reproducteurs. On peut s'en protéger grâce à l'utilisation de préservatifs. Le dépistage passe par un frottis vaginal, anal et de la gorge ou par un test d'urine. +gale_descr=Maladie de la peau causée par un parasite, il creuse des cavités sous la surface de la peau, dont il se nourrit, et y pond ses oeufs. Sans grande gravité, elle est néanmoins très contagieuse. Eviter les contacts prolongé avec une personne contaminée ou ses vêtements est nécessaire pour s'en protéger. La gale est dépistée lors d'un examen médicale. +morpion_descr=Insecte parasite qui cible spécifiquement les poils du pubis. Il occasionne de fortes gênes et ses morsures favorisent les infections d'autres IST. Se raser les poils pubiens empèche le développement des morpions. Leur présence est déterminée par un examen médicale ou un auto-examen. alternariose_descr=Série de maladies fongiques causant des brûlures à certains types de plantes, comme les tournesols, les tomates et les carottes. Elle peut être considérée comme une IST pour plante. froidepisse_descr=La chaude pisse est un synonyme de la gonorhée, en revanche la froide pisse est une maladie imaginaire. -lycanthropie_descr=Comme dans la légende du lycanthrope, pour devenir un loup-garou un sim doit être mordu par un loup (chef de meute) pour devenir Loup-garou. Plus tard il peut également être mordu par un loup-garou pour être lui aussi atteint de lycanthropie. -mononucleose_descr=La mononucléose infectieuse est la primo-infection symptomatique généralement bénigne, elle est provoquée par le virus d'Epstein-Barr, appartenant à la même famille de virus que l'Herpès. Près de 95% des adultes dans le monde l'ont déjà attrapé. +lycanthropie_descr=Comme dans la légende du lycanthrope, pour devenir un loup-garou un sim doit être mordu par un loup alpha (chef de meute) pour devenir Loup-garou. Plus tard il peut également être mordu par un loup-garou pour être lui aussi atteint de lycanthropie. +mononucleose_descr=La mononucléose infectieuse est la primo-infection symptomatique généralement bénigne, elle est provoquée par le virus d'Epstein-Barr, appartenant à la même famille de virus que l'Herpès. Près de 95% des adultes dans le monde l'ont déjà attrapée. depression_descr=La dépression est un trouble mental caractérisé par des épisodes de baisse d'humeur accompagnée d'une faible estime de soi et d'une perte de plaisir ou d'intérêt dans des activités habituellement agréables. tetanos_descr=Le tétanos est une infection locale provoquée par une bactérie, produisant une neurotoxine ciblant le système nerveux central. Cette toxine est l'un des plus puissants poisons biologiques connus et entraîne la mort dans 20 à 30% des cas. cancer_descr=C'est une maladie provoquée par la transformation de cellules qui deviennent anormales et prolifèrent de façon excessive. diff --git a/kapotopia/android/assets/yellow.png b/kapotopia/android/assets/yellow.png new file mode 100644 index 0000000..e43f70a Binary files /dev/null and b/kapotopia/android/assets/yellow.png differ diff --git a/kapotopia/core/src/gdx/kapotopia/AssetsManaging/AssetDescriptors.java b/kapotopia/core/src/gdx/kapotopia/AssetsManaging/AssetDescriptors.java index 84b354a..caddd85 100644 --- a/kapotopia/core/src/gdx/kapotopia/AssetsManaging/AssetDescriptors.java +++ b/kapotopia/core/src/gdx/kapotopia/AssetsManaging/AssetDescriptors.java @@ -9,6 +9,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.utils.I18NBundle; +import org.w3c.dom.Text; + import java.util.Locale; public class AssetDescriptors { @@ -34,14 +36,28 @@ public class AssetDescriptors { // Main Menu public static final AssetDescriptor MM_PART1 = new AssetDescriptor(AssetPaths.MM_PART1, Texture.class); // % loaded at the start + public static final AssetDescriptor MM_PART1_CUT = + new AssetDescriptor(AssetPaths.MM_PART1_CUT, Texture.class); // % loaded at the start public static final AssetDescriptor MM_PART3 = new AssetDescriptor(AssetPaths.MM_PART3, Texture.class); // % loaded at the start + public static final AssetDescriptor MM_PART3_CUT = + new AssetDescriptor(AssetPaths.MM_PART3_CUT, Texture.class); // % loaded at the start public static final AssetDescriptor MM_PART4 = - new AssetDescriptor(AssetPaths.MM_PART4, Texture.class); // % loaded at the start + new AssetDescriptor(AssetPaths.MM_PART4_CUT, Texture.class); // % loaded at the start + public static final AssetDescriptor MM_PART4_CUT = + new AssetDescriptor(AssetPaths.MM_PART4_CUT, Texture.class); // % loaded at the start public static final AssetDescriptor MM_W1 = new AssetDescriptor(AssetPaths.MM_W1, Texture.class); // % loaded at the start + public static final AssetDescriptor WORLD1_GAME1 = + new AssetDescriptor(AssetPaths.WORLD1_GAME1, Texture.class); // % loaded at the start + public static final AssetDescriptor WORLD1_GAME2 = + new AssetDescriptor(AssetPaths.WORLD1_GAME2, Texture.class); // % loaded at the start public static final AssetDescriptor MM_W2 = new AssetDescriptor(AssetPaths.MM_W2, Texture.class); // % loaded at the start + public static final AssetDescriptor MM1_W2 = + new AssetDescriptor(AssetPaths.MM1_W2, Texture.class); // % loaded at the start + public static final AssetDescriptor MM2_W2 = + new AssetDescriptor(AssetPaths.MM2_W2, Texture.class); // % loaded at the start // Options public static final AssetDescriptor OP_BACK = new AssetDescriptor(AssetPaths.OP_BACK, Texture.class); // % loaded at the start @@ -52,6 +68,8 @@ public class AssetDescriptors { // Game1 public static final AssetDescriptor B1_BACK = new AssetDescriptor(AssetPaths.B1_BACK, Texture.class); + public static final AssetDescriptor Failed = + new AssetDescriptor(AssetPaths.Failed, Texture.class); // Game2 public static final AssetDescriptor BALL = new AssetDescriptor(AssetPaths.BALL, Texture.class); @@ -102,11 +120,90 @@ public class AssetDescriptors { new AssetDescriptor(AssetPaths.NEON_GREEN, Texture.class); public static final AssetDescriptor NEON_VIOLET = new AssetDescriptor(AssetPaths.NEON_VIOLET, Texture.class); + //Game4 + public static final AssetDescriptor BACKGROUND_DISC = + new AssetDescriptor(AssetPaths.BACKGROUND_DISC,Texture.class); + public static final AssetDescriptor COVER_GAME4 = + new AssetDescriptor(AssetPaths.COVER_GAME4, Texture.class); + public static final AssetDescriptor BACKGROUND_GAME4 = + new AssetDescriptor(AssetPaths.BACKGROUND_GAME4, Texture.class); + public static final AssetDescriptor DOWN_ARROW4 = + new AssetDescriptor(AssetPaths.DOWN_ARROW4, Texture.class); + public static final AssetDescriptor UP_ARROW4 = + new AssetDescriptor(AssetPaths.UP_ARROW4, Texture.class); + public static final AssetDescriptor LEFT_ARROW4 = + new AssetDescriptor(AssetPaths.LEFT_ARROW4, Texture.class); + public static final AssetDescriptor RIGHT_ARROW4 = + new AssetDescriptor(AssetPaths.RIGHT_ARROW4, Texture.class); + public static final AssetDescriptor PAUSE_LOGO4 = + new AssetDescriptor(AssetPaths.PAUSE_LOGO4, Texture.class); + public static final AssetDescriptor PLAY_LOGO4 = + new AssetDescriptor(AssetPaths.PLAY_LOGO4, Texture.class); + public static final AssetDescriptor YELLOW_BACK = + new AssetDescriptor(AssetPaths.YELLOW_BACK, Texture.class); + public static final AssetDescriptor PALEBLUE_BACK = + new AssetDescriptor(AssetPaths.PALEBLUE_BACK, Texture.class); + public static final AssetDescriptor ANULINGUS = + new AssetDescriptor(AssetPaths.ANULINGUS, Texture.class); + public static final AssetDescriptor CARESSES = + new AssetDescriptor(AssetPaths.CARESSES, Texture.class); + public static final AssetDescriptor CUNNI = + new AssetDescriptor(AssetPaths.CUNNI, Texture.class); + public static final AssetDescriptor SERINGUE_CHANGE = + new AssetDescriptor(AssetPaths.SERINGUE_CHANGE, Texture.class); + public static final AssetDescriptor EMBRASSADE = + new AssetDescriptor(AssetPaths.EMBRASSADE, Texture.class); + public static final AssetDescriptor FELLATION = + new AssetDescriptor(AssetPaths.FELLATION, Texture.class); + public static final AssetDescriptor GANT = + new AssetDescriptor(AssetPaths.GANT, Texture.class); + public static final AssetDescriptor PENE_VAGINALE = + new AssetDescriptor(AssetPaths.PENE_VAGINALE, Texture.class); + public static final AssetDescriptor PENE_ANALE = + new AssetDescriptor(AssetPaths.PENE_ANALE, Texture.class); + public static final AssetDescriptor ISTCHOICE = + new AssetDescriptor(AssetPaths.ISTCHOICE, Texture.class); + public static final AssetDescriptor VIH = + new AssetDescriptor(AssetPaths.VIH, Texture.class); + public static final AssetDescriptor HEPA = + new AssetDescriptor(AssetPaths.HEPA, Texture.class); + public static final AssetDescriptor HEPB = + new AssetDescriptor(AssetPaths.HEPB, Texture.class); + public static final AssetDescriptor HEPC = + new AssetDescriptor(AssetPaths.HEPC, Texture.class); + public static final AssetDescriptor SYPHILIS = + new AssetDescriptor(AssetPaths.SYPHILIS, Texture.class); + public static final AssetDescriptor HERPES = + new AssetDescriptor(AssetPaths.HERPES, Texture.class); + public static final AssetDescriptor PAPILLO = + new AssetDescriptor(AssetPaths.PAPILLO, Texture.class); + public static final AssetDescriptor CHLAMYDIA = + new AssetDescriptor(AssetPaths.CHLAMYDIA, Texture.class); + public static final AssetDescriptor GONORRHEE = + new AssetDescriptor(AssetPaths.GONORRHEE, Texture.class); + public static final AssetDescriptor TRICHOMONAS = + new AssetDescriptor(AssetPaths.TRICHOMONAS, Texture.class); + public static final AssetDescriptor MIREILLE_FOOD = + new AssetDescriptor(AssetPaths.MIREILLE_FOOD, Texture.class); + + public static final AssetDescriptor RED_SQUARE = + new AssetDescriptor(AssetPaths.RED_SQUARE, Texture.class); + public static final AssetDescriptor GREEN_SQUARE = + new AssetDescriptor(AssetPaths.GREEN_SQUARE, Texture.class); + public static final AssetDescriptor BLUE_SQUARE = + new AssetDescriptor(AssetPaths.BLUE_SQUARE, Texture.class); + + public static final AssetDescriptor LEGEND_FR = + new AssetDescriptor(AssetPaths.LEGEND_FR, Texture.class); + public static final AssetDescriptor LEGEND_EN = + new AssetDescriptor(AssetPaths.LEGEND_EN, Texture.class); // STIDex public static final AssetDescriptor DEX_BACK = new AssetDescriptor(AssetPaths.DEX_BACK, Texture.class); public static final AssetDescriptor ARROW = new AssetDescriptor(AssetPaths.ARROW, Texture.class); + public static final AssetDescriptor CLOSE = + new AssetDescriptor(AssetPaths.CLOSE, Texture.class); // IntroG1 public static final AssetDescriptor DIF_PART1 = new AssetDescriptor(AssetPaths.DIF_PART1, Texture.class); // % loaded at the start diff --git a/kapotopia/core/src/gdx/kapotopia/AssetsManaging/AssetPaths.java b/kapotopia/core/src/gdx/kapotopia/AssetsManaging/AssetPaths.java index 78af898..e9b19e7 100644 --- a/kapotopia/core/src/gdx/kapotopia/AssetsManaging/AssetPaths.java +++ b/kapotopia/core/src/gdx/kapotopia/AssetsManaging/AssetPaths.java @@ -12,16 +12,25 @@ public class AssetPaths { public static final String BLANK_BACK = "FondNiveauBlanc2.png"; // Main Menu public static final String MM_PART1 = "EcranMenu/MenuPrincipalCadre1.png"; + public static final String MM_PART1_CUT = "EcranMenu/MenuPrincipalCadre1_cut.png"; public static final String MM_PART3 = "EcranMenu/MenuPrincipalCadre3.png"; + public static final String MM_PART3_CUT = "EcranMenu/MenuPrincipalCadre3_cut.png"; + public static final String MM_PART4 = "EcranMenu/MenuPrincipalBoutons.png"; + public static final String MM_PART4_CUT = "EcranMenu/MenuPrincipalBoutons_cut.png"; public static final String MM_W1 = "EcranMenu/World1EcranMenu.png"; + public static final String WORLD1_GAME1 = "EcranMenu/World1EcranMenuCadre1_cut.png"; + public static final String WORLD1_GAME2 = "EcranMenu/World1EcranMenuCadre2_cut.png"; public static final String MM_W2 = "game3/intro/Monde2Ecran1.png"; + public static final String MM1_W2 = "game3/intro/Monde2Ecran1_cut.png"; + public static final String MM2_W2 = "game4/game_cover.png"; // Options public static final String OP_BACK = "EcranMenu/EcranOption.png"; public static final String OP_SPEAKER = "icons/speaker.png"; public static final String OP_MUTE = "icons/mute.png"; // Game1 public static final String B1_BACK = "World1/Game1/EcranTotal.png"; + public static final String Failed = "World1/Game1/Failed.png"; // Game2 public static final String BALL = "World1/Game2/Ballon.png"; public static final String SABLE = "World1/Game2/Sable.png"; @@ -48,9 +57,49 @@ public class AssetPaths { public static final String NEON_TURQUOISE = "game3/NeonsTurquoises.png"; public static final String NEON_GREEN = "game3/NeonsVerts.png"; public static final String NEON_VIOLET = "game3/NeonsViolets.png"; + // Game 4 + public static final String COVER_GAME4 = "game4/game_cover.png"; + public static final String BACKGROUND_GAME4 = "game4/background_game.png"; + public static final String DOWN_ARROW4 = "game4/down_arrow.png"; + public static final String UP_ARROW4 = "game4/up_arrow.png"; + public static final String LEFT_ARROW4 = "game4/left_arrow.png"; + public static final String RIGHT_ARROW4 = "game4/right_arrow.png"; + public static final String PAUSE_LOGO4 = "game4/pause_logo.png"; + public static final String PLAY_LOGO4 = "game4/play_logo.png"; + public static final String YELLOW_BACK = "ISTback/yellow.png"; + public static final String PALEBLUE_BACK = "ISTback/paleBlue.png"; + public static final String ANULINGUS = "game4/annulingus.png"; + public static final String CARESSES = "game4/caresses.png"; + public static final String CUNNI = "game4/cunni.png"; + public static final String SERINGUE_CHANGE = "game4/echange_seringue.png"; + public static final String EMBRASSADE = "game4/Embrassade.png"; + public static final String FELLATION = "game4/fellation.png"; + public static final String GANT = "game4/gant.png"; + public static final String PENE_VAGINALE = "game4/pene_vaginal.png"; + public static final String PENE_ANALE = "game4/pene_anale.png"; + public static final String ISTCHOICE = "game4/ISTChoice.png"; + public static final String VIH = "IST/VIH.png"; + public static final String HEPA = "IST/HepatiteA.png"; + public static final String HEPB = "IST/HepatiteB.png"; + public static final String HEPC = "IST/HepatiteC.png"; + public static final String SYPHILIS = "IST/Syphilis.png"; + public static final String HERPES = "IST/Herpes.png"; + public static final String PAPILLO = "IST/Papillomavirus.png"; + public static final String CHLAMYDIA = "IST/Chlamydia.png"; + public static final String GONORRHEE= "IST/Gonorrhee.png"; + public static final String TRICHOMONAS = "IST/Trichomonas.png"; + public static final String MIREILLE_FOOD = "game4/Mireille.png"; + + public static final String RED_SQUARE= "game4/red_square.png"; + public static final String BLUE_SQUARE = "game4/blue_square.png"; + public static final String GREEN_SQUARE = "game4/green_square.png"; + + public static final String LEGEND_FR = "game4/legend_fr.png"; + public static final String LEGEND_EN = "game4/legend_en.png"; // STIDex public static final String DEX_BACK = "Pokedex.png"; public static final String ARROW = "ui_arrow.png"; + public static final String CLOSE = "close.png"; // Intro G1 public static final String DIF_PART1 = "EcranMenu/EcranJeu1Haut.png"; public static final String JUNGLE = "World1/Game1/Jungle.png"; @@ -60,6 +109,8 @@ public class AssetPaths { // IntroG3 public static final String I3_HOUSE = "game3/intro/Monde2Ecran1.png"; public static final String I3_INSIDE = "game3/intro/Monde2Ecran2.png"; + //IntroG4 + public static final String BACKGROUND_DISC = "game4/background_discussion.png"; // Characters public static final String MI_NORMAL = "MireilleImages/Mireille.png"; public static final String MI_HAPPY = "MireilleImages/MireilleBoucheOuverte.png"; diff --git a/kapotopia/core/src/gdx/kapotopia/Game1/GameController.java b/kapotopia/core/src/gdx/kapotopia/Game1/GameController.java index 149a7c0..a4d40db 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game1/GameController.java +++ b/kapotopia/core/src/gdx/kapotopia/Game1/GameController.java @@ -5,8 +5,8 @@ import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.EventListener; -import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Button; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.utils.Timer; @@ -122,7 +122,7 @@ private void setConstants(float worldW, float worldH) { float z = 21 * x; float y = (worldW - x - z) / 3; this.MIN_X = x; - this.MAX_X = worldW - z; + this.MAX_X = worldW - z + 20; this.MIN_Y = 25; this.MOVE_VALUE_X = y; } @@ -143,12 +143,14 @@ public void updateOnShow(Stage stage) { // We ensure that after the animation has played, the game really start if(!letsGoAppeared) { final float delay = game1.getRenderController().getFirstAnimationTimeLeft(); + game1.getRenderController().getPauseIcon().setVisible(false); Timer.schedule(new Timer.Task() { @Override public void run() { letsGoAppeared = true; isPaused = false; Gdx.app.debug(TAG, "LetsGoAppeared - isPaused is false"); + game1.getRenderController().getPauseIcon().setVisible(true); } }, delay); } @@ -198,6 +200,7 @@ public void makeJojoAppear(float delta) { if (jojoAppears && !jojoHasAppeared) { game1.getRenderController().jojo(delta); if (!jojoTimerLaunched) { + game1.getRenderController().getPauseIcon().setVisible(false); game1.getSoundController().startJojo(); // We upgrade the difficulty => NIGHTMARE MODE ennemi.setAccAddFactor(0.09f); @@ -212,6 +215,7 @@ public void run() { isPaused = false; Gdx.app.debug(TAG, "Jojo has appeared - isPaused is false"); mireille.resetPosition(); + game1.getRenderController().getPauseIcon().setVisible(true); } }, 6f); jojoTimerLaunched = true; @@ -274,6 +278,7 @@ public void addMissedIST(boolean isMaybeIST, String virusName) { missedIsts.add(vc); game1.getRenderController().playMissedLabelAnim(); + mireille.decreaseScore(); } /** @@ -309,7 +314,7 @@ public void changed(ChangeEvent event, Actor actor) { break; case HARD: // We send the player to the next game, so GAME 2 - game.changeScreen(ScreenType.MOCKUPG2); + game.changeScreen(ScreenType.GAME1); break; } } @@ -433,40 +438,76 @@ private void setUpInputProcessor(Stage stage) { im.addProcessor(new SimpleDirectionGestureDetector(new SimpleDirectionGestureDetector.DirectionListener() { @Override public void onLeft() { - Jcount = 0; + /////USED WITH OLD MOVE CONTROLS + /* Jcount = 0; Gdx.app.debug(TAG, "swipe left - isPaused is " + isPaused); if(!isPaused) { final float newX = Math.max(mireille.getX() - MOVE_VALUE_X, MIN_X); updateMireille(newX); - } + }*/ } @Override public void onRight() { - Jcount = 0; + /*Jcount = 0; Gdx.app.debug(TAG, "swipe right - isPaused is " + isPaused); if(!isPaused) { final float xAndMoveValue = mireille.getX() + MOVE_VALUE_X; final float newX = Math.min(xAndMoveValue, MAX_X); Gdx.app.log(TAG, "Math.min( " + xAndMoveValue + " , " + MAX_X + " )"); updateMireille(newX); - } + }*/ } @Override public void onUp() { - Jcount++; + /*Jcount++; Gdx.app.debug(TAG , "swipe up - isPaused is " + isPaused); if (Jcount >= 3) { isPaused = true; jojoAppears = true; - } + }*/ } @Override public void onDown() { + /*Jcount = 0; + Gdx.app.debug(TAG, "swipe down - isPaused is " + isPaused);*/ + } + + @Override + public void onTouch() { + if (!isPaused && Gdx.input.getY() > game.viewport.getWorldHeight()*0.3f) { + Jcount += 1; + if (Jcount >= 50 && !jojoAppears) { + isPaused = true; + jojoAppears = true; + Jcount = 0; + } + int x = Gdx.input.getX(); + float newX = x - mireille.getWidth(); + if (newX > MAX_X) { + newX = MAX_X; + } else if (newX < MIN_X) { + newX = MIN_X; + } + updateMireille(newX); + } + } + + @Override + public void onPan() { Jcount = 0; - Gdx.app.debug(TAG, "swipe down - isPaused is " + isPaused); + if (!isPaused && Gdx.input.getY() > game.viewport.getWorldHeight()*0.3f) { + int x = Gdx.input.getX(); + float newX = x - mireille.getWidth() - 15; + if (newX > MAX_X) { + newX = MAX_X; + } else if (newX < MIN_X) { + newX = MIN_X; + } + updateMireille(newX); + } } private void updateMireille(float newX) { diff --git a/kapotopia/core/src/gdx/kapotopia/Game1/MireilleBasic.java b/kapotopia/core/src/gdx/kapotopia/Game1/MireilleBasic.java index 3cd98c9..9058107 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game1/MireilleBasic.java +++ b/kapotopia/core/src/gdx/kapotopia/Game1/MireilleBasic.java @@ -3,8 +3,10 @@ import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.Action; +import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.Timer; +import java.awt.Image; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -33,6 +35,7 @@ public class MireilleBasic extends EntityAbstract { private Random random; private byte lifes; private int score; + private boolean caughtNotSTD; private boolean jojoActivated; /* @@ -92,6 +95,11 @@ public void increaseScore() { increaseScore(SCORE_UP); } + public void decreaseScore(){ + int SCORE_DOWN = -10; + increaseScore(SCORE_DOWN); + } + public void increaseScore(int add) { this.score += add; notifyScoreChanged(this.score); @@ -104,6 +112,13 @@ public void increaseScore(int add) { public void decreaseLife() { if(this.lifes > 0) { this.lifes--; + this.caughtNotSTD = true; + Timer.schedule(new Timer.Task() { + @Override + public void run() { + caughtNotSTD = false; + } + }, 1f); System.out.println("Mireille a été touchée !"); } else { hide(); @@ -116,6 +131,7 @@ public void decreaseLife() { this.score -= 15; notifyScoreChanged(this.score); + notifySTDChanged(caughtNotSTD); this.updateCollision(this.getX(),this.getY()); @@ -137,6 +153,12 @@ private void notifyScoreChanged(final int score) { } } + private void notifySTDChanged(final boolean c) { + for(MireilleListener l : listeners) { + l.caughtNotSTD(c); + } + } + /* * GETTERS ET SETTERS */ diff --git a/kapotopia/core/src/gdx/kapotopia/Game1/MireilleListener.java b/kapotopia/core/src/gdx/kapotopia/Game1/MireilleListener.java index 7445615..9fb9efd 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game1/MireilleListener.java +++ b/kapotopia/core/src/gdx/kapotopia/Game1/MireilleListener.java @@ -6,4 +6,5 @@ public interface MireilleListener { void lifeChanged(byte life); void scoreChanged(int score); + void caughtNotSTD(boolean c); } diff --git a/kapotopia/core/src/gdx/kapotopia/Game1/RenderController.java b/kapotopia/core/src/gdx/kapotopia/Game1/RenderController.java index d86f6cd..230382e 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game1/RenderController.java +++ b/kapotopia/core/src/gdx/kapotopia/Game1/RenderController.java @@ -65,10 +65,10 @@ public class RenderController { private Label scoreLabel; private Label istCatchedLabel; private Label ennemiNameLabel; - private Label pauseLabel; private Label missedLabel; private ImageButton pauseIcon; private ImageTextButton quitBtn; + private ImageTextButton pauseBtn; // Constants @@ -135,12 +135,41 @@ public void changed(ChangeEvent event, Actor actor) { } }; + EventListener pauseEvent = new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if(game1.getGameController().isPaused()) { + pauseIcon.setChecked(false); + game1.resumeFromPause(); + } else { + pauseIcon.setChecked(true); + game1.pause(); + } + Gdx.app.debug(TAG, "pauseLabel clicked - isPaused is " + game1.getGameController().isPaused()); + } + }; + quitBtn = new ImageTextButtonBuilder(game, loc.getString("quit_button_text")) - .withFontStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE).withAlignment(Alignement.CENTER) - .withY((game1.getGameController().getBounds().getHeight() / 2) - BTN_SPACING).withPadding(Padding.STANDARD) - .withListener(quitEvent).withImageStyle(game.ass.get(AssetDescriptors.BTN_LEAF)).isVisible(false).build(); + .withFontStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withAlignment(Alignement.CENTER) + .withY((game1.getGameController().getBounds().getHeight() / 2) - BTN_SPACING) + .withPadding(Padding.STANDARD) + .withListener(quitEvent) + .withImageStyle(game.ass.get(AssetDescriptors.BTN_LEAF)) + .isVisible(false) + .build(); + + pauseBtn = new ImageTextButtonBuilder(game, loc.getString("continue_button")) + .withFontStyle(normalFont).withAlignment(Alignement.CENTER) // faut rajouter le x + .withY(game1.getGameController().getBounds().height / 2) + .isVisible(false) + .withImageStyle(game.ass.get(AssetDescriptors.BTN_LEAF)) + .withPadding(Padding.STANDARD) + .withListener(pauseEvent) + .build(); stage.addActor(quitBtn); + stage.addActor(pauseBtn); // Labels lifeLabel = new LabelBuilder(game, game.loc.getString("lives_label") + game1.getGameController().getMireilleLife()).withStyle(normalFont) @@ -149,29 +178,14 @@ public void changed(ChangeEvent event, Actor actor) { .withPosition(25, game1.getGameController().getBounds().height - (ww / 10.8f)).build(); scoreLabel = new LabelBuilder(game, game.loc.getString("score2_label") + game1.getGameController().getTotalScore()).withStyle(normalFont) .withPosition(25, game1.getGameController().getBounds().height - (ww / 5.4f)).build(); - pauseLabel = new LabelBuilder(game, loc.getString("pause_label_text")).withStyle(normalFont).withAlignment(Alignement.CENTER) // faut rajouter le x - .withY(game1.getGameController().getBounds().height / 2).isVisible(false).build(); missedLabel = new LabelBuilder(game, loc.getString("missed_label_text")).withStyle(smallFont).isVisible(false).build(); ennemiNameLabel = new LabelBuilder(game, game1.getGameController().getEnnemi().getName()).withStyle(smallFont).withTextAlignement(Align.center) .withPosition(game1.getGameController().getEnnemi().getX() + (game1.getGameController().getEnnemi().getRealWidth() - game1.getGameController().getEnnemi().getName().length()) /2, game1.getGameController().getEnnemi().getY() - (ww / 10.8f)).build(); - pauseLabel.addListener(new ClickListener() { - @Override - public void clicked(InputEvent event, float x, float y) { - if(game1.getGameController().isPaused()) { - game1.resumeFromPause(); - } else { - game1.pause(); - } - Gdx.app.debug(TAG, "pauseLabel clicked - isPaused is " + game1.getGameController().isPaused()); - } - }); - stage.addActor(lifeLabel); stage.addActor(istCatchedLabel); stage.addActor(scoreLabel); - stage.addActor(pauseLabel); stage.addActor(missedLabel); stage.addActor(ennemiNameLabel); } @@ -216,12 +230,12 @@ public void renderFirstAnimation(float stateTime) { } public void updateWhenResumeFromPause() { - pauseLabel.setVisible(false); + pauseBtn.setVisible(false); quitBtn.setVisible(false); } public void updateAtPause() { - pauseLabel.setVisible(true); + pauseBtn.setVisible(true); quitBtn.setVisible(true); } @@ -362,10 +376,18 @@ public float getFirstAnimationTimeLeft() { return this.letsGoAnimation.getFrameDuration() * this.letsGoAnimation.getKeyFrames().length; } + public float getTotalAnimationDuration() { + return this.letsGoAnimation.getAnimationDuration(); + } + public void jojo(float delta) { jojo.draw(delta); } + public ImageButton getPauseIcon() { + return this.pauseIcon; + } + /* * DEBUG METHODS */ diff --git a/kapotopia/core/src/gdx/kapotopia/Game1/SoundController.java b/kapotopia/core/src/gdx/kapotopia/Game1/SoundController.java index 97e4ced..7ddf7a1 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game1/SoundController.java +++ b/kapotopia/core/src/gdx/kapotopia/Game1/SoundController.java @@ -99,6 +99,6 @@ public void playScoreChangedSuccess() { } public void playWhenMireilleMove() { - jumpSound.play(); + } } diff --git a/kapotopia/core/src/gdx/kapotopia/Game1/Virus.java b/kapotopia/core/src/gdx/kapotopia/Game1/Virus.java index b3cb7bc..808f5bd 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game1/Virus.java +++ b/kapotopia/core/src/gdx/kapotopia/Game1/Virus.java @@ -7,6 +7,7 @@ import java.util.Random; +import gdx.kapotopia.GameConfig; import gdx.kapotopia.Helpers.Align; import gdx.kapotopia.Screens.Game1; @@ -80,10 +81,22 @@ private void setNewRandPosition() { public void changeVirusType() { this.setTexture(new TextureRegion(updateNewVirus())); updateRealUnits(); - game.changeEnnemiLabel(this.getName()); + String label = this.getName(); + final float labelLength = this.getName().length() * GameConfig.ONE_CHAR_SMALL_WIDTH; + String newLabel; + if (labelLength >= 1.1*this.getRealWidth()){ + newLabel = label.substring(0,this.getName().length()/2) + "-\n" + label.substring(this.getName().length()/2, this.getName().length()); + } + else{ + newLabel = this.getName(); + } + + game.changeEnnemiLabel(newLabel); setNewRandPosition(); + + // We update the X position of the name label to make it fit right - this.nameLabX = Align.getXCenteredWithElement(this.getX(), this.getRealWidth(), this.getName().length()); + this.nameLabX = Align.getXCenteredWithElement(this.getX(), this.getRealWidth(), newLabel.length()); } /** diff --git a/kapotopia/core/src/gdx/kapotopia/Game3/Core.java b/kapotopia/core/src/gdx/kapotopia/Game3/Core.java index 151ff58..ef3fb25 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game3/Core.java +++ b/kapotopia/core/src/gdx/kapotopia/Game3/Core.java @@ -30,6 +30,7 @@ public class Core { private Game3 parent; private boolean succeeded; + private ArrayList names; private Pair [][] tiles; private int sizex; @@ -121,6 +122,7 @@ public Core(Game3 parent, int sizex, int sizey, int nbGoals){ createPath(correctGoal, sizey-1); updatePath(tiles[0][0]); + this.names = names; } private void addLine(int x, int y){ @@ -392,6 +394,15 @@ private boolean checkGoal(){ return false; } + private boolean checkWrongConnection(Goal g){ + Tile t = tiles[g.pos][sizey-1].connection(0); + if(t != null && t.isLit() && g.pos != correctGoal){ + g.open(); + return true; + } + return false; + } + /** * Colors the whole path that's connected to the input. * @param moved Pair of tiles whose move has potentially changed the connected path @@ -490,7 +501,22 @@ void touchHandler(int x, int y){ if(checkGoal()){ // Game Over this.succeeded = true; - parent.back(); + + int c = 0; + int i = 0; + ArrayList unsafeUnlocked = new ArrayList(); + for (Goal g : goals){ + if(checkWrongConnection(g)){ + c++; + String s = this.names.get(i); + unsafeUnlocked.add(s); + Gdx.app.debug(this.getClass().getSimpleName(), "string key : "+ s); + } + i++; + } + Gdx.app.debug(this.getClass().getSimpleName(), "number of wrong locks unlocked : " + c); + + parent.back(unsafeUnlocked); } } } @@ -757,7 +783,7 @@ class Goal{ popup = new PopUpBuilder(game, stage); popup.setTitle("TEMPLATE"); - TextButton btnYes = new TextButtonBuilder(game, "CANCEL").withStyle(FontHelper.AESTHETIC_NORMAL_BLACK).build(); + TextButton btnYes = new TextButtonBuilder(game, game.loc.getString("cancel_button")).withStyle(FontHelper.AESTHETIC_NORMAL_WHITE).build(); btnYes.addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { diff --git a/kapotopia/core/src/gdx/kapotopia/Game4/BodyPart.java b/kapotopia/core/src/gdx/kapotopia/Game4/BodyPart.java new file mode 100644 index 0000000..69d4baa --- /dev/null +++ b/kapotopia/core/src/gdx/kapotopia/Game4/BodyPart.java @@ -0,0 +1,36 @@ +package gdx.kapotopia.Game4; + +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; + +public class BodyPart { + private float x; + private float y; + private ImageButton ib; + + public BodyPart(float x, float y, int boardSize) { + this.x = x % (boardSize - 2); + if (this.x<0) { + this.x += boardSize - 2; + } + this.y = y % boardSize; + if (this.y<0) { + this.y += boardSize; + } + } + + public float getX() { + return x; + } + + public float getY() { + return y; + } + + public ImageButton getIb() { + return ib; + } + + public void setIb(ImageButton ib) { + this.ib = ib; + } +} diff --git a/kapotopia/core/src/gdx/kapotopia/Game4/Food.java b/kapotopia/core/src/gdx/kapotopia/Game4/Food.java new file mode 100644 index 0000000..db3dfcd --- /dev/null +++ b/kapotopia/core/src/gdx/kapotopia/Game4/Food.java @@ -0,0 +1,126 @@ +package gdx.kapotopia.Game4; + +import com.badlogic.gdx.Screen; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; + +import org.graalvm.compiler.loop.MathUtil; + +import java.util.ArrayList; + +import gdx.kapotopia.AssetsManaging.AssetDescriptors; +import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; +import gdx.kapotopia.Kapotopia; +import gdx.kapotopia.Screens.Game4; + +public class Food { + private float x; + private float y; + private int type; //0-2,3,4 unsafe, safe, protection + private ImageButton sqr; + private ImageButton logo; + private Game4 screen; + private float scaleSnake; + private int xOffset; + private int yOffset; + private Kapotopia game; + + //[IST][Practice] + private final int[][] tab = {{1,1,1,0,0,0,0,1}, + {0,1,0,0,1,0,0,0}, + {1,1,1,1,0,0,1,1}, + {0,1,0,0,0,0,0,1}, + {1,1,1,1,1,1,1,1}, + {1,1,1,1,1,1,1,0}, + {1,1,1,1,1,1,0,0}, + {1,1,1,1,1,1,0,0}, + {1,1,1,1,1,1,0,0}, + {1,0,1,1,1,1,0,0} + }; + + private Texture[] practices; + + private ArrayList risked = new ArrayList(); + private ArrayList notRisked = new ArrayList(); + private final Texture[] safe; + + public Food(int boardSize, Game4 screen, float scaleSnake, int xOffset, int yOffset, Kapotopia game) { + this.scaleSnake = scaleSnake; + this.screen = screen; + this.xOffset = xOffset; + this.yOffset = yOffset; + this.game = game; + practices = new Texture[]{game.ass.get(AssetDescriptors.PENE_VAGINALE), game.ass.get(AssetDescriptors.PENE_ANALE), game.ass.get(AssetDescriptors.FELLATION), game.ass.get(AssetDescriptors.CUNNI), game.ass.get(AssetDescriptors.ANULINGUS), game.ass.get(AssetDescriptors.CARESSES), game.ass.get(AssetDescriptors.EMBRASSADE), game.ass.get(AssetDescriptors.SERINGUE_CHANGE)}; + safe = new Texture[]{game.ass.get(AssetDescriptors.MIREILLE_FOOD), game.ass.get(AssetDescriptors.ALYX_OPEN), game.ass.get(AssetDescriptors.GANT)}; + fillRisks(); + randomise(boardSize); + } + + public void randomise(int boardSize) { + x = MathUtils.random(boardSize-2); + y = MathUtils.random(boardSize-1); + type = MathUtils.random(4); + + if (type < 3) { + sqr = new ImageButtonBuilder() + .withBounds(x * scaleSnake + xOffset, y * scaleSnake + yOffset, scaleSnake, scaleSnake) + .withImageUp(game.ass.get(AssetDescriptors.RED_SQUARE)) + .build(); + logo = new ImageButtonBuilder() + .withBounds(x * scaleSnake + xOffset, y * scaleSnake + yOffset, scaleSnake, scaleSnake) + .withImageUp(risked.get(MathUtils.random(risked.size()-1))) + .build(); + } else if (type == 3) { + logo = new ImageButtonBuilder() + .withBounds(x * scaleSnake + xOffset, y * scaleSnake + yOffset, scaleSnake, scaleSnake) + .withImageUp(notRisked.get(MathUtils.random(notRisked.size()-1))) + .build(); + sqr = new ImageButtonBuilder() + .withBounds(x * scaleSnake + xOffset, y * scaleSnake + yOffset, scaleSnake, scaleSnake) + .withImageUp(game.ass.get(AssetDescriptors.GREEN_SQUARE)) + .build(); + } else { //always 4 + logo = new ImageButtonBuilder() + .withBounds(x * scaleSnake + xOffset, y * scaleSnake + yOffset, scaleSnake, scaleSnake) + .withImageUp(safe[MathUtils.random(safe.length-1)]) + .build(); + sqr = new ImageButtonBuilder() + .withBounds(x * scaleSnake + xOffset, y * scaleSnake + yOffset, scaleSnake, scaleSnake) + .withImageUp(game.ass.get(AssetDescriptors.BLUE_SQUARE)) + .build(); + } + screen.getStage().addActor(sqr); + screen.getStage().addActor(logo); + } + + private void fillRisks() { + for (int i = 0; i < tab[game.vars.getChosenSTD()].length; i++) { + if (tab[game.vars.getChosenSTD()][i] == 1) { + risked.add(practices[i]); + } else { + notRisked.add(practices[i]); + } + } + } + + public float getX() { + return x; + } + + public float getY() { + return y; + } + + public int getType() { + return type; + } + + public ImageButton getSqr() { + return sqr; + } + + public ImageButton getLogo() { + return logo; + } +} diff --git a/kapotopia/core/src/gdx/kapotopia/Game4/GameState.java b/kapotopia/core/src/gdx/kapotopia/Game4/GameState.java new file mode 100644 index 0000000..d17cef2 --- /dev/null +++ b/kapotopia/core/src/gdx/kapotopia/Game4/GameState.java @@ -0,0 +1,302 @@ +package gdx.kapotopia.Game4; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Screen; +import com.badlogic.gdx.graphics.OrthographicCamera; +import com.badlogic.gdx.graphics.Texture; + +import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; +import com.badlogic.gdx.utils.Queue; +import com.badlogic.gdx.utils.viewport.Viewport; + +import org.w3c.dom.Text; + +import java.util.ArrayList; +import java.util.concurrent.CopyOnWriteArrayList; + +import javax.swing.text.View; + +import gdx.kapotopia.AssetsManaging.AssetDescriptors; +import gdx.kapotopia.Helpers.Builders.ImageBuilder; +import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; +import gdx.kapotopia.Kapotopia; +import gdx.kapotopia.ScreenType; +import gdx.kapotopia.Screens.Game4; + +public class GameState { + + private final String TAG = this.getClass().getSimpleName(); + + private Kapotopia game; + Game4 screen; + + private int totalScore; + + private int snakeSize = 10; // 10-15 squares square + private int boardSize = 11; + private int yOffset = 308; + private int xOffset = 30; + private int direction = 0; + private Queue mBody = new Queue(); + private CopyOnWriteArrayList foods= new CopyOnWriteArrayList(); + private int snakeLength = 3; + long prevtime = 0; + private boolean isPaused; + private boolean isFinish; + private final Rectangle bounds; + + private final Texture IST; + + private float mTimer = 0; + + public GameState(Kapotopia game, Game4 screen) { + this.game = game; + this.screen = screen; + this.isPaused = false; + this.bounds = new Rectangle(0,0, game.viewport.getWorldWidth(), game.viewport.getWorldHeight()); + + switch (game.vars.getChosenSTD()){ + case 0: + IST = game.ass.get(AssetDescriptors.VIH); + break; + case 1: + IST = game.ass.get(AssetDescriptors.HEPA); + break; + case 2: + IST = game.ass.get(AssetDescriptors.HEPB); + break; + case 3: + IST = game.ass.get(AssetDescriptors.HEPC); + break; + case 4: + IST = game.ass.get(AssetDescriptors.SYPHILIS); + break; + case 5: + IST = game.ass.get(AssetDescriptors.HERPES); + break; + case 6: + IST = game.ass.get(AssetDescriptors.PAPILLO); + break; + case 7: + IST = game.ass.get(AssetDescriptors.CHLAMYDIA); + break; + case 8: + IST = game.ass.get(AssetDescriptors.GONORRHEE); + break; + case 9: + IST = game.ass.get(AssetDescriptors.TRICHOMONAS); + break; + default: //should never happen + IST = game.ass.get(AssetDescriptors.TRICHOMONAS); + } + + + this.totalScore = 0; + float scaleSnake = game.viewport.getWorldWidth()/snakeSize; + BodyPart bp1 = new BodyPart(15,15, boardSize); + mBody.addLast(bp1); + ImageButton img1 = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp1.getX()*scaleSnake + xOffset, bp1.getY()*scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img1); + bp1.setIb(img1); + + BodyPart bp2 = new BodyPart(15,14, boardSize); + mBody.addLast(bp2); + ImageButton img2 = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp2.getX()*scaleSnake + xOffset, bp2.getY()*scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img2); + bp2.setIb(img2); + + BodyPart bp3 = new BodyPart(15,13, boardSize); + mBody.addLast(bp3); + ImageButton img3 = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp3.getX()*scaleSnake + xOffset, bp3.getY()*scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img3); + bp3.setIb(img3); + } + + public void setDirection(int nextDirection){ + if (direction == 0 && nextDirection != 2) { + this.direction = nextDirection; + } else if (direction == 2 && nextDirection != 0) { + this.direction = nextDirection; + } else if (direction == 1 && nextDirection != 3){ + this.direction = nextDirection; + } else if (direction == 3 && nextDirection != 1){ + this.direction = nextDirection; + } + } + + public int getTotalScore() { + return this.totalScore; + } + + public void updateOnPause() { + isPaused = true; + } + + public void updateOnResume() { + isPaused = true; + } + + public void resumeFromPause() { + isPaused = false; + } + + public void updateOnHide() { + isPaused = true; + Gdx.app.debug(TAG, "game hidden - isPaused is true"); + } + + public void update(float delta, Viewport viewport) { + if (!isPaused()){ + mTimer += delta; + long timestamp = System.currentTimeMillis() / 1000; // time in seconds + if (timestamp % 4 == 0 && timestamp != prevtime) { + float width = game.viewport.getWorldWidth(); + float scaleSnake = width/snakeSize; + Food f = new Food(snakeSize, screen, scaleSnake, xOffset, yOffset, game); + foods.add(f); + if (foods.size() == 11) { //max 10 foods on screen + foods.remove(0); + } + } + prevtime = timestamp; + + if (mTimer > 0.17f) { //change 0.17f to change snake speed + mTimer = 0; + advance(); + } + } + + } + + private void advance() { + float headX = mBody.first().getX(); + float headY = mBody.first().getY(); + float scaleSnake = game.viewport.getWorldWidth()/snakeSize; + switch(this.direction) { + case 0: //up + BodyPart bp = new BodyPart(headX, headY+1, boardSize); + mBody.addFirst(bp); + ImageButton img1 = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp.getX()*scaleSnake + xOffset, bp.getY()*scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img1); + bp.setIb(img1); + break; + case 1: //right + BodyPart bp1 = new BodyPart(headX+1, headY, boardSize); + mBody.addFirst(bp1); + ImageButton img2 = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp1.getX()*scaleSnake + xOffset, bp1.getY()*scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img2); + bp1.setIb(img2); + break; + case 2: //down + BodyPart bp2 = new BodyPart(headX, headY-1, boardSize); + mBody.addFirst(bp2); + ImageButton img3 = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp2.getX()*scaleSnake + xOffset, bp2.getY()*scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img3); + bp2.setIb(img3); + break; + case 3: //left + BodyPart bp3 = new BodyPart(headX-1, headY, boardSize); + mBody.addFirst(bp3); + ImageButton img4 = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp3.getX()*scaleSnake + xOffset, bp3.getY()*scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img4); + bp3.setIb(img4); + break; + default://should never happen + BodyPart bp4 = new BodyPart(headX, headY+1, boardSize); + mBody.addFirst(bp4); + ImageButton img5 = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp4.getX()*scaleSnake + xOffset, bp4.getY()*scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img5); + bp4.setIb(img5); + break; + } + + //see if food is eaten + for (Food f: foods) { + if (mBody.first().getX() == f.getX() && mBody.first().getY() == f.getY()) { + if (f.getType() < 3) { + this.totalScore += 10; + snakeLength++; + } else if (f.getType() == 3 || f.getType() == 4) { + snakeLength--; + this.totalScore -= 10; + if (snakeLength == 0) { + game.destroyScreen(screen); + game.changeScreen(ScreenType.WORLD2); + } + } else { //should never happen + snakeLength++; + } + f.getSqr().remove(); + f.getLogo().remove(); + foods.remove(f); + } + } + + for (int i = 1; i < mBody.size; i++) { //when dire reset to length 3 + if (mBody.get(i).getX() == mBody.first().getX() && + mBody.get(i).getY() == mBody.first().getY()) { + game.destroyScreen(screen); + game.changeScreen(ScreenType.WORLD2); + } + } + + while (mBody.size - 1 >= snakeLength) { + mBody.last().getIb().remove(); + mBody.removeLast(); + } + } + + public void draw(float width, float height, OrthographicCamera camera) { + //snake + float scaleSnake = width / snakeSize; + for (BodyPart bp : mBody) { + bp.getIb().remove(); + ImageButton img = new ImageButtonBuilder() + .withImageUp(IST) + .withBounds(bp.getX() * scaleSnake + xOffset, bp.getY() * scaleSnake + yOffset, scaleSnake, scaleSnake) + .build(); + screen.getStage().addActor(img); + bp.setIb(img); + } + } + + // GETTERS + + public boolean isPaused() { + return isPaused; + } + + public boolean isFinish() { + return isFinish; + } + + public Rectangle getBounds() { + return bounds; + } +} diff --git a/kapotopia/core/src/gdx/kapotopia/Game4/Choice.java b/kapotopia/core/src/gdx/kapotopia/Game5/Choice.java similarity index 93% rename from kapotopia/core/src/gdx/kapotopia/Game4/Choice.java rename to kapotopia/core/src/gdx/kapotopia/Game5/Choice.java index 1390829..db29088 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game4/Choice.java +++ b/kapotopia/core/src/gdx/kapotopia/Game5/Choice.java @@ -1,4 +1,4 @@ -package gdx.kapotopia.Game4; +package gdx.kapotopia.Game5; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.ui.Button; diff --git a/kapotopia/core/src/gdx/kapotopia/Game4/Mireille.java b/kapotopia/core/src/gdx/kapotopia/Game5/Mireille.java similarity index 98% rename from kapotopia/core/src/gdx/kapotopia/Game4/Mireille.java rename to kapotopia/core/src/gdx/kapotopia/Game5/Mireille.java index cd87253..d5809e2 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game4/Mireille.java +++ b/kapotopia/core/src/gdx/kapotopia/Game5/Mireille.java @@ -1,4 +1,4 @@ -package gdx.kapotopia.Game4; +package gdx.kapotopia.Game5; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; diff --git a/kapotopia/core/src/gdx/kapotopia/Game4/Question.java b/kapotopia/core/src/gdx/kapotopia/Game5/Question.java similarity index 94% rename from kapotopia/core/src/gdx/kapotopia/Game4/Question.java rename to kapotopia/core/src/gdx/kapotopia/Game5/Question.java index 983b699..08b1536 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game4/Question.java +++ b/kapotopia/core/src/gdx/kapotopia/Game5/Question.java @@ -1,4 +1,4 @@ -package gdx.kapotopia.Game4; +package gdx.kapotopia.Game5; public class Question { diff --git a/kapotopia/core/src/gdx/kapotopia/Game4/Timer.java b/kapotopia/core/src/gdx/kapotopia/Game5/Timer.java similarity index 74% rename from kapotopia/core/src/gdx/kapotopia/Game4/Timer.java rename to kapotopia/core/src/gdx/kapotopia/Game5/Timer.java index 9eb82fa..ec00639 100644 --- a/kapotopia/core/src/gdx/kapotopia/Game4/Timer.java +++ b/kapotopia/core/src/gdx/kapotopia/Game5/Timer.java @@ -1,4 +1,4 @@ -package gdx.kapotopia.Game4; +package gdx.kapotopia.Game5; import com.badlogic.gdx.scenes.scene2d.Actor; diff --git a/kapotopia/core/src/gdx/kapotopia/GlobalVariables.java b/kapotopia/core/src/gdx/kapotopia/GlobalVariables.java index e66d30b..ccfed82 100644 --- a/kapotopia/core/src/gdx/kapotopia/GlobalVariables.java +++ b/kapotopia/core/src/gdx/kapotopia/GlobalVariables.java @@ -11,6 +11,7 @@ public class GlobalVariables { private GameDifficulty choosenDifficultyG1; private UnlockedLevel game1UnlockedLevels; private ScreenType nextScreenOfChoosingDifScreen; + private int chosenSTD; public GlobalVariables(Localisation loc) { // We define the default value of variables @@ -18,6 +19,7 @@ public GlobalVariables(Localisation loc) { choosenDifficultyG1 = GameDifficulty.EASY; game1UnlockedLevels = UnlockedLevel.EASY_UNLOCKED; nextScreenOfChoosingDifScreen = ScreenType.MAINMENU; + chosenSTD = 0; // default } public GameDifficulty getChoosenDifficultyG1() { @@ -47,4 +49,12 @@ public void setNextScreenOfChoosingDifScreen(ScreenType nextScreenOfChoosingDifS public STIData getStiData() { return stiData; } + + public int getChosenSTD() { + return chosenSTD; + } + + public void setChosenSTD(int chosenSTD) { + this.chosenSTD = chosenSTD; + } } diff --git a/kapotopia/core/src/gdx/kapotopia/Helpers/AnimatedDrawable.java b/kapotopia/core/src/gdx/kapotopia/Helpers/AnimatedDrawable.java new file mode 100644 index 0000000..221030a --- /dev/null +++ b/kapotopia/core/src/gdx/kapotopia/Helpers/AnimatedDrawable.java @@ -0,0 +1,37 @@ +package gdx.kapotopia.Helpers; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.g2d.Animation; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable; + +public class AnimatedDrawable extends BaseDrawable { + + private Animation animation; + private TextureRegion keyFrame; + private float stateTime = 0; + + public AnimatedDrawable(Animation animation){ + + this.animation = animation; + TextureRegion key = animation.getKeyFrame(0); + + this.setLeftWidth(key.getRegionWidth()/2); + this.setRightWidth(key.getRegionWidth()/2); + this.setTopHeight(key.getRegionHeight()/2); + this.setBottomHeight(key.getRegionHeight()/2); + this.setMinWidth(key.getRegionWidth()); + this.setMinHeight(key.getRegionHeight()); + + } + + @Override + public void draw(Batch batch, float x, float y, float width, float height){ + + stateTime += Gdx.graphics.getDeltaTime(); + keyFrame = animation.getKeyFrame(stateTime, true); + + batch.draw(keyFrame, x,y, keyFrame.getRegionWidth(), keyFrame.getRegionHeight()); + } +} \ No newline at end of file diff --git a/kapotopia/core/src/gdx/kapotopia/Helpers/Builders/ImageButtonBuilder.java b/kapotopia/core/src/gdx/kapotopia/Helpers/Builders/ImageButtonBuilder.java index aba11d2..38a8ab7 100644 --- a/kapotopia/core/src/gdx/kapotopia/Helpers/Builders/ImageButtonBuilder.java +++ b/kapotopia/core/src/gdx/kapotopia/Helpers/Builders/ImageButtonBuilder.java @@ -10,6 +10,7 @@ import gdx.kapotopia.Helpers.Align; import gdx.kapotopia.Helpers.Alignement; +import gdx.kapotopia.Kapotopia; /** * A class to help build ImageButton. A mandatory argument is the text displayed in the ImageButton diff --git a/kapotopia/core/src/gdx/kapotopia/Helpers/Builders/PopUpBuilder.java b/kapotopia/core/src/gdx/kapotopia/Helpers/Builders/PopUpBuilder.java index b15a7a2..471f199 100644 --- a/kapotopia/core/src/gdx/kapotopia/Helpers/Builders/PopUpBuilder.java +++ b/kapotopia/core/src/gdx/kapotopia/Helpers/Builders/PopUpBuilder.java @@ -63,7 +63,7 @@ public void setTitle(String title){ if(title != null){ dialog.getContentTable().removeActor(this.title); } - this.title = new LabelBuilder(game, title).withStyle(FontHelper.CLASSIC_BOLD_NORMAL_WHITE).build(); + this.title = new LabelBuilder(game, title).withStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE).build(); this.title.setAlignment(Align.center); dialog.getContentTable().add(this.title).padTop(40f); } diff --git a/kapotopia/core/src/gdx/kapotopia/Helpers/SimpleDirectionGestureDetector.java b/kapotopia/core/src/gdx/kapotopia/Helpers/SimpleDirectionGestureDetector.java index 8e2a507..3cd54f0 100644 --- a/kapotopia/core/src/gdx/kapotopia/Helpers/SimpleDirectionGestureDetector.java +++ b/kapotopia/core/src/gdx/kapotopia/Helpers/SimpleDirectionGestureDetector.java @@ -11,6 +11,10 @@ public interface DirectionListener { void onUp(); void onDown(); + + void onTouch(); + + void onPan(); } public SimpleDirectionGestureDetector(DirectionListener directionListener) { @@ -42,6 +46,18 @@ public boolean fling(float velocityX, float velocityY, int button) { return super.fling(velocityX, velocityY, button); } + @Override + public boolean touchDown (float x, float y, int pointer, int button) { + directionListener.onTouch(); + return super.touchDown(x, y, pointer, button); + } + + @Override + public boolean pan (float x, float y, float deltaX, float deltaY) { + directionListener.onPan(); + return super.pan(x, y, deltaX, deltaY); + } + } } diff --git a/kapotopia/core/src/gdx/kapotopia/Kapotopia.java b/kapotopia/core/src/gdx/kapotopia/Kapotopia.java index 538cd71..b6166a6 100644 --- a/kapotopia/core/src/gdx/kapotopia/Kapotopia.java +++ b/kapotopia/core/src/gdx/kapotopia/Kapotopia.java @@ -17,9 +17,11 @@ import gdx.kapotopia.STIDex.STI; import gdx.kapotopia.Screens.BilanG1; import gdx.kapotopia.Screens.ChoosingDifficultyScreen; +import gdx.kapotopia.Screens.ChoosingSTDScreen; import gdx.kapotopia.Screens.Game1; import gdx.kapotopia.Screens.Game2; import gdx.kapotopia.Screens.Game3; +import gdx.kapotopia.Screens.Game4; import gdx.kapotopia.Screens.IntroCutscene; import gdx.kapotopia.Screens.LoadingScreen; import gdx.kapotopia.Screens.MainMenu; @@ -31,6 +33,7 @@ import gdx.kapotopia.Screens.mockupG1; import gdx.kapotopia.Screens.mockupG2; import gdx.kapotopia.Screens.mockupG3; +import gdx.kapotopia.Screens.mockupG4; public class Kapotopia extends com.badlogic.gdx.Game { @@ -59,16 +62,19 @@ public class Kapotopia extends com.badlogic.gdx.Game { private Game1 game1; private Game2 game2; private Game3 game3; + private Game4 game4; private MainMenu mainMenu; private mockupG1 mockupG1; private mockupG2 mockupG2; private mockupG3 mockupG3; + private mockupG4 mockupG4; private BilanG1 bilanG1; private World1 world1; private World2 world2; private World3 world3; private STIDex STIDex; private ChoosingDifficultyScreen dif; + private ChoosingSTDScreen STDGAME4; private Options options; private IntroCutscene introCutscene; @@ -126,16 +132,26 @@ private void loadInitialTextures() { this.ass.load(AssetDescriptors.PLAY_LOGO); // Main Menu this.ass.load(AssetDescriptors.MM_PART1); + this.ass.load(AssetDescriptors.MM_PART1_CUT); this.ass.load(AssetDescriptors.ANIM_NEON_DOOR); this.ass.load(AssetDescriptors.MM_PART3); + this.ass.load(AssetDescriptors.MM_PART3_CUT); this.ass.load(AssetDescriptors.MM_PART4); + this.ass.load(AssetDescriptors.MM_PART4_CUT); // Options this.ass.load(AssetDescriptors.SKIN_COMIC_UI); this.ass.load(AssetDescriptors.OP_BACK); this.ass.load(AssetDescriptors.OP_MUTE); this.ass.load(AssetDescriptors.OP_SPEAKER); + // World 2 + this.ass.load(AssetDescriptors.MM1_W2); + this.ass.load(AssetDescriptors.MM2_W2); // Game 1 this.ass.load(AssetDescriptors.B1_BACK); + // Game 4 + this.ass.load(AssetDescriptors.YELLOW_BACK); + this.ass.load(AssetDescriptors.PALEBLUE_BACK); + // IntroG1 this.ass.load(AssetDescriptors.DIF_PART1); this.ass.load(AssetDescriptors.JUNGLE); @@ -143,6 +159,8 @@ private void loadInitialTextures() { this.ass.load(AssetDescriptors.LEAVES); this.ass.load(AssetDescriptors.CROQUIS); this.ass.load(AssetDescriptors.MM_W1); + this.ass.load(AssetDescriptors.WORLD1_GAME1); + this.ass.load(AssetDescriptors.WORLD1_GAME2); // IntroG2 this.ass.load(AssetDescriptors.SABLE); this.ass.load(AssetDescriptors.SEA); @@ -197,6 +215,7 @@ private void loadInitialTextures() { this.ass.load(AssetDescriptors.MI_JOJO_POSE); this.ass.load(AssetDescriptors.MI_JOJO_KANJI); this.ass.load(AssetDescriptors.PAUSE_LOGO); + this.ass.load(AssetDescriptors.Failed); // Musics this.ass.load(AssetDescriptors.MUSIC_GAME1); this.ass.load(AssetDescriptors.MUSIC_J); @@ -237,6 +256,46 @@ private void loadInitialTextures() { // Sounds this.ass.load(AssetDescriptors.MUSIC_GAME3); + //ASSETS FOR GAME 4 + this.ass.load(AssetDescriptors.BACKGROUND_GAME4); + this.ass.load(AssetDescriptors.BACKGROUND_DISC); + this.ass.load(AssetDescriptors.COVER_GAME4); + this.ass.load(AssetDescriptors.DOWN_ARROW4); + this.ass.load(AssetDescriptors.UP_ARROW4); + this.ass.load(AssetDescriptors.LEFT_ARROW4); + this.ass.load(AssetDescriptors.RIGHT_ARROW4); + this.ass.load(AssetDescriptors.PAUSE_LOGO4); + this.ass.load(AssetDescriptors.PLAY_LOGO4); + this.ass.load(AssetDescriptors.ANULINGUS); + this.ass.load(AssetDescriptors.CARESSES); + this.ass.load(AssetDescriptors.CUNNI); + this.ass.load(AssetDescriptors.SERINGUE_CHANGE); + this.ass.load(AssetDescriptors.EMBRASSADE); + this.ass.load(AssetDescriptors.FELLATION); + this.ass.load(AssetDescriptors.GANT); + this.ass.load(AssetDescriptors.PENE_VAGINALE); + this.ass.load(AssetDescriptors.PENE_ANALE); + this.ass.load(AssetDescriptors.ISTCHOICE); + + this.ass.load(AssetDescriptors.VIH); + this.ass.load(AssetDescriptors.HEPA); + this.ass.load(AssetDescriptors.HEPB); + this.ass.load(AssetDescriptors.HEPC); + this.ass.load(AssetDescriptors.SYPHILIS); + this.ass.load(AssetDescriptors.HERPES); + this.ass.load(AssetDescriptors.PAPILLO); + this.ass.load(AssetDescriptors.CHLAMYDIA); + this.ass.load(AssetDescriptors.GONORRHEE); + this.ass.load(AssetDescriptors.TRICHOMONAS); + this.ass.load(AssetDescriptors.MIREILLE_FOOD); + this.ass.load(AssetDescriptors.LEGEND_EN); + this.ass.load(AssetDescriptors.LEGEND_FR); + + this.ass.load(AssetDescriptors.RED_SQUARE); + this.ass.load(AssetDescriptors.GREEN_SQUARE); + this.ass.load(AssetDescriptors.BLUE_SQUARE); + // IST-INDEX + this.ass.load(AssetDescriptors.CLOSE); } @@ -277,12 +336,18 @@ public boolean destroyScreen(Screen sc) { return destroyScreen(ScreenType.GAME2); } else if(sc == game3) { return destroyScreen(ScreenType.GAME3); + } else if (sc == game4) { + return destroyScreen(ScreenType.GAME4); } else if(sc == mainMenu) { return destroyScreen(ScreenType.MAINMENU); } else if(sc == mockupG1) { return destroyScreen(ScreenType.MOCKUPG1); } else if(sc == mockupG2) { return destroyScreen(ScreenType.MOCKUPG2); + } else if(sc == mockupG3) { + return destroyScreen(ScreenType.MOCKUPG3); + } else if(sc == mockupG4) { + return destroyScreen(ScreenType.MOCKUPG4); } else if(sc == bilanG1) { return destroyScreen(ScreenType.BILANG1); } else if(sc == world1) { @@ -299,6 +364,8 @@ public boolean destroyScreen(Screen sc) { return destroyScreen(ScreenType.OPTIONS); } else if(sc == introCutscene) { return destroyScreen(ScreenType.INTROCUTSCENE); + } else if (sc == STDGAME4) { + return destroyScreen(ScreenType.STDGAME4); } return false; @@ -313,15 +380,19 @@ public void resetEveryScreen(ScreenType nextScreen) { destroyScreen(ScreenType.GAME1); destroyScreen(ScreenType.GAME2); destroyScreen(ScreenType.GAME3); + destroyScreen(ScreenType.GAME4); destroyScreen(ScreenType.MAINMENU); destroyScreen(ScreenType.MOCKUPG1); destroyScreen(ScreenType.MOCKUPG2); + destroyScreen(ScreenType.MOCKUPG3); + destroyScreen(ScreenType.MOCKUPG4); destroyScreen(ScreenType.BILANG1); destroyScreen(ScreenType.WORLD1); destroyScreen(ScreenType.WORLD2); destroyScreen(ScreenType.WORLD3); destroyScreen(ScreenType.STIDEX); destroyScreen(ScreenType.DIFGAME1); + destroyScreen(ScreenType.STDGAME4); destroyScreen(ScreenType.OPTIONS); destroyScreen(ScreenType.INTROCUTSCENE); changeScreen(nextScreen); @@ -384,6 +455,22 @@ private boolean selectScreen(ScreenAction ACTION, ScreenType TYPE) { break; } break; + case GAME4: + switch (ACTION) { + case CHANGE: + if (game4 == null) game4 = new Game4(this); + setScreen(game4); + succeeded = true; + break; + case DESTROY: + if (game4 != null) { + game4.dispose(); + game4 = null; + succeeded = true; + } + break; + } + break; case WORLD1: switch (ACTION) { case CHANGE: @@ -512,6 +599,22 @@ private boolean selectScreen(ScreenAction ACTION, ScreenType TYPE) { break; } break; + case MOCKUPG4: + switch (ACTION) { + case CHANGE: + if (mockupG4 == null) mockupG4 = new mockupG4(this); + setScreen(mockupG4); + succeeded = true; + break; + case DESTROY: + if (mockupG4 != null) { + mockupG4.dispose(); + mockupG4 = null; + succeeded = true; + } + break; + } + break; case BILANG1: switch (ACTION) { case CHANGE: @@ -544,6 +647,22 @@ private boolean selectScreen(ScreenAction ACTION, ScreenType TYPE) { break; } break; + case STDGAME4: + switch (ACTION) { + case CHANGE: + if (STDGAME4 == null) STDGAME4 = new ChoosingSTDScreen(this); + setScreen(STDGAME4); + succeeded = true; + break; + case DESTROY: + if (STDGAME4 != null) { + STDGAME4.dispose(); + STDGAME4 = null; + succeeded = true; + } + break; + } + break; case OPTIONS: switch (ACTION) { case CHANGE: @@ -644,6 +763,10 @@ public MusicController getMusicControl() { return musicControl; } + public ChoosingSTDScreen getChoosingSTDScreen() { + return STDGAME4; + } + private enum ScreenAction { DESTROY, CHANGE diff --git a/kapotopia/core/src/gdx/kapotopia/ReturnButtonManager.java b/kapotopia/core/src/gdx/kapotopia/ReturnButtonManager.java index b807945..4a1211c 100644 --- a/kapotopia/core/src/gdx/kapotopia/ReturnButtonManager.java +++ b/kapotopia/core/src/gdx/kapotopia/ReturnButtonManager.java @@ -12,18 +12,21 @@ public ReturnButtonManager(Kapotopia game) { this.previousScreens = new HashMap(); this.previousScreens.put(ScreenType.INTROCUTSCENE, ScreenType.INTROCUTSCENE); this.previousScreens.put(ScreenType.MAINMENU, ScreenType.INTROCUTSCENE); - this.previousScreens.put(ScreenType.GAME1, ScreenType.MOCKUPG1); - this.previousScreens.put(ScreenType.GAME2, ScreenType.MOCKUPG2); - this.previousScreens.put(ScreenType.GAME3, ScreenType.MOCKUPG3); + this.previousScreens.put(ScreenType.GAME1, ScreenType.WORLD1); + this.previousScreens.put(ScreenType.GAME2, ScreenType.WORLD1); + this.previousScreens.put(ScreenType.GAME3, ScreenType.WORLD2); + this.previousScreens.put(ScreenType.GAME4, ScreenType.WORLD2); this.previousScreens.put(ScreenType.MOCKUPG1, ScreenType.WORLD1); - this.previousScreens.put(ScreenType.MOCKUPG2, ScreenType.WORLD2); - this.previousScreens.put(ScreenType.MOCKUPG3, ScreenType.WORLD3); + this.previousScreens.put(ScreenType.MOCKUPG2, ScreenType.WORLD1); + this.previousScreens.put(ScreenType.MOCKUPG3, ScreenType.WORLD2); + this.previousScreens.put(ScreenType.MOCKUPG4, ScreenType.WORLD2); this.previousScreens.put(ScreenType.BILANG1, ScreenType.GAME1); this.previousScreens.put(ScreenType.WORLD1, ScreenType.MAINMENU); this.previousScreens.put(ScreenType.WORLD2, ScreenType.MAINMENU); this.previousScreens.put(ScreenType.WORLD3, ScreenType.MAINMENU); this.previousScreens.put(ScreenType.STIDEX, ScreenType.MAINMENU); this.previousScreens.put(ScreenType.DIFGAME1, ScreenType.WORLD1); + this.previousScreens.put(ScreenType.STDGAME4, ScreenType.WORLD2); this.previousScreens.put(ScreenType.OPTIONS, ScreenType.MAINMENU); this.returnScreen = previousScreens.get(ScreenType.INTROCUTSCENE); } diff --git a/kapotopia/core/src/gdx/kapotopia/ScreenType.java b/kapotopia/core/src/gdx/kapotopia/ScreenType.java index ebb9c9c..aa68b54 100644 --- a/kapotopia/core/src/gdx/kapotopia/ScreenType.java +++ b/kapotopia/core/src/gdx/kapotopia/ScreenType.java @@ -6,14 +6,17 @@ public enum ScreenType { GAME1, GAME2, GAME3, + GAME4, MOCKUPG1, MOCKUPG2, MOCKUPG3, + MOCKUPG4, BILANG1, WORLD1, WORLD2, WORLD3, STIDEX, DIFGAME1, + STDGAME4, OPTIONS } diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/ChoosingSTDScreen.java b/kapotopia/core/src/gdx/kapotopia/Screens/ChoosingSTDScreen.java new file mode 100644 index 0000000..221a072 --- /dev/null +++ b/kapotopia/core/src/gdx/kapotopia/Screens/ChoosingSTDScreen.java @@ -0,0 +1,484 @@ +package gdx.kapotopia.Screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.InputMultiplexer; +import com.badlogic.gdx.Screen; +import com.badlogic.gdx.audio.Sound; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.OrthographicCamera; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.InputListener; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.utils.Timer; + +import org.graalvm.compiler.hotspot.IsGraalPredicate; + +import java.util.ArrayList; + +import gdx.kapotopia.AssetsManaging.AssetDescriptors; +import gdx.kapotopia.Fonts.FontHelper; +import gdx.kapotopia.GameDifficulty; +import gdx.kapotopia.Helpers.Builders.ImageBuilder; +import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; +import gdx.kapotopia.Helpers.Builders.PopUpBuilder; +import gdx.kapotopia.Helpers.Builders.TextButtonBuilder; +import gdx.kapotopia.Helpers.ChangeScreenListener; +import gdx.kapotopia.Helpers.StandardInputAdapter; +import gdx.kapotopia.Kapotopia; +import gdx.kapotopia.ScreenType; + +public class ChoosingSTDScreen implements Screen { + + private Kapotopia game; + private Stage stage; + private OrthographicCamera camera; + + private Sound clic; + private Sound clicBlockedSound; + private Sound pauseSound; + + private boolean popupHere = false; + + private Stage popStage; + + public ChoosingSTDScreen(final Kapotopia game) { + this.game = game; + this.stage = new Stage(game.viewport); + this.camera = new OrthographicCamera(game.viewport.getWorldWidth(), game.viewport.getWorldHeight()); + this.camera.position.set(camera.viewportWidth / 2f, camera.viewportHeight / 2f,0); + game.viewport.setCamera(camera); + this.camera.update(); + popStage = new Stage(game.viewport); + + + this.clic = game.ass.get(AssetDescriptors.SOUND_CLICKED_BTN); + this.clicBlockedSound = game.ass.get(AssetDescriptors.SOUND_HINT); + this.pauseSound = game.ass.get(AssetDescriptors.SOUND_PAUSE); + + float screenHeight = game.viewport.getWorldHeight(); + float screenWidth = game.viewport.getWorldWidth(); + + + Image fond = new ImageBuilder() + .withTexture(game.ass.get(AssetDescriptors.ISTCHOICE)) + .build(); + + ImageButton VIH= new ImageButtonBuilder() + .withBounds(0,4*screenHeight/5f, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.VIH)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(0); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + + TextButton VIH_Text = new TextButtonBuilder(game, game.loc.getString("hiv_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(screenWidth/5.5f, 4*screenHeight/5) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(0); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton HEPA = new ImageButtonBuilder() + .withBounds(screenWidth/2f,4*screenHeight/5f, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.HEPA)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(1); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Hepa_Text = new TextButtonBuilder(game, game.loc.getString("a_hepatitis_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(screenWidth/1.8f, 4*screenHeight/5) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(1); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton HEPB = new ImageButtonBuilder() + .withBounds(0,3*screenHeight/5f, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.HEPB)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(2); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Hepb_Text = new TextButtonBuilder(game, game.loc.getString("b_hepatitis_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(screenWidth/8, 3*screenHeight/5) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(2); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton HEPC = new ImageButtonBuilder() + .withBounds(screenWidth/2f,3*screenHeight/5f, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.HEPC)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(3); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Hepc_Text = new TextButtonBuilder(game, game.loc.getString("c_hepatitis_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(screenWidth/1.8f, 3*screenHeight/5) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(3); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton SYPH = new ImageButtonBuilder() + .withBounds(0,2*screenHeight/5f, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.SYPHILIS)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(4); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Syph_Text = new TextButtonBuilder(game, game.loc.getString("syphilis_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(screenWidth/8, 2*screenHeight/5) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(4); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton HERP = new ImageButtonBuilder() + .withBounds(screenWidth/2f,2*screenHeight/5f, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.HERPES)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(5); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Herp_Text = new TextButtonBuilder(game, game.loc.getString("herpes_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(screenWidth/2, 2*screenHeight/5) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(5); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton PAPIL = new ImageButtonBuilder() + .withBounds(0,screenHeight/5f, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.PAPILLO)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(6); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Papil_Text = new TextButtonBuilder(game, game.loc.getString("hpv_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(0, screenHeight/5) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(6); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton CHLA = new ImageButtonBuilder() + .withBounds(screenWidth/2f,screenHeight/5f, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.CHLAMYDIA)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(7); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Chla_Text = new TextButtonBuilder(game, game.loc.getString("chlamydia_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(screenWidth/1.8f, screenHeight/5) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(7); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton GONO = new ImageButtonBuilder() + .withBounds(0,0, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.GONORRHEE)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(8); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Gono_Text = new TextButtonBuilder(game, game.loc.getString("gonorrhea_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_BLACK) + .withPosition(screenWidth/10, 0) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(8); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + ImageButton TRICH = new ImageButtonBuilder() + .withBounds(screenWidth/2f,0, screenWidth/2f, screenHeight/5f) + .withImageUp(game.ass.get(AssetDescriptors.TRICHOMONAS)) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(9); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + TextButton Trich_Text = new TextButtonBuilder(game, game.loc.getString("trichomonas_name")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(screenWidth/2, 0) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + if (!popupHere) { + game.vars.setChosenSTD(9); + game.destroyScreen(ScreenType.STDGAME4); + game.changeScreen(ScreenType.GAME4); + } + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + + stage.addActor(fond); + stage.addActor(VIH); + stage.addActor(HEPA); + stage.addActor(HEPB); + stage.addActor(HEPC); + stage.addActor(SYPH); + stage.addActor(HERP); + stage.addActor(PAPIL); + stage.addActor(CHLA); + stage.addActor(GONO); + stage.addActor(TRICH); + stage.addActor(VIH_Text); + stage.addActor(Hepa_Text); + stage.addActor(Hepb_Text); + stage.addActor(Hepc_Text); + stage.addActor(Syph_Text); + stage.addActor(Herp_Text); + stage.addActor(Papil_Text); + stage.addActor(Chla_Text); + stage.addActor(Gono_Text); + stage.addActor(Trich_Text); + chooseSTDPopup(); + } + + @Override + public void show() { + setUpInputProcessor(); + } + + /** + * Set up the input processor with the StandardInputAdapter + */ + protected void setUpInputProcessor() { + InputMultiplexer im = new InputMultiplexer(); + im.addProcessor(new StandardInputAdapter(this, game)); + im.addProcessor(popStage); + im.addProcessor(stage); + Gdx.input.setInputProcessor(im); + } + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(0, 0, 0, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + + camera.update(); + + stage.act(Gdx.graphics.getDeltaTime()); + stage.draw(); + popStage.draw(); + popStage.act(Gdx.graphics.getDeltaTime()); + + } + + @Override + public void resize(int width, int height) { + game.viewport.update(width, height, true); + } + + @Override + public void pause() { + pauseSound.play(); + } + + @Override + public void resume() { + + } + + @Override + public void hide() { + + } + + @Override + public void dispose() { + stage.dispose(); + popStage.dispose(); + } + + public void chooseSTDPopup() { + + final PopUpBuilder popup = new PopUpBuilder(game, popStage); + popupHere = true; + + String title = game.loc.getString("game4_choose"); + + popup.setTitle(title); + + TextButton btnYes = new TextButtonBuilder(game, game.loc.getString("next_button")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { + System.out.println("closed"); + popup.close(); + popupHere = false; + return super.touchDown(event, x, y, pointer, button); + } + }) + .build(); + + popup.addButton(btnYes); + popup.setPosition(0,(int)game.viewport.getWorldHeight()/3); + popup.show(); + } + +} diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/CinematicScreen.java b/kapotopia/core/src/gdx/kapotopia/Screens/CinematicScreen.java index b8695c3..31084c6 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/CinematicScreen.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/CinematicScreen.java @@ -24,11 +24,15 @@ import gdx.kapotopia.Fonts.Font; import gdx.kapotopia.Fonts.FontHelper; import gdx.kapotopia.Helpers.Builders.FixedDialogSeqBuilder; +import gdx.kapotopia.Helpers.Builders.ImageTextButtonBuilder; import gdx.kapotopia.Helpers.Builders.TextButtonBuilder; import gdx.kapotopia.Helpers.StandardInputAdapter; import gdx.kapotopia.Kapotopia; +import gdx.kapotopia.Languages; import gdx.kapotopia.ScreenType; +import gdx.kapotopia.Helpers.Padding; + /** * This class define a common base for screens where only cinematics, shown with static pictures, are shown * The class has a list of Image to show in a specific order, only two buttons are used "next" and "finish". @@ -52,6 +56,7 @@ public abstract class CinematicScreen implements Screen { // Interaction private Button next; private Button finish; + private Button previous; /* FUNCTIONS */ @@ -90,7 +95,7 @@ private void builder(final ScreenType nextScreen, Label[] labels, Label[][] labelsBigList, AssetDescriptor fond, AssetDescriptor changeOfImageSoundDescr, AssetDescriptor endSoundDescr, AssetDescriptor pauseSoundDescr, String nextBtnLabel, - String finishBtnLabel, Font nextBtnFont, Font finishBtnFont, + String finishBtnLabel, Font nextBtnFont, Font finishBtnFont, String previousBtnLabel, Font previousBtnFont, final float timerScheduleTime, final int vibrationTime, final boolean withFinishBtn) { // Graphics this.sequence = FixedDialogSeqBuilder.buildSequence(game, stage, imagesBigList, images, imagesTexturePaths, @@ -105,13 +110,27 @@ private void builder(final ScreenType nextScreen, this.changeOfImageSound = game.ass.get(changeOfImageSoundDescr); this.endSound = game.ass.get(endSoundDescr); this.pauseSound = game.ass.get(pauseSoundDescr); - // Buttons - Font styleNextBtn = nextBtnFont; - Font styleFinishBtn = finishBtnFont; + + // Texture + Texture texture; + if (nextScreen==ScreenType.DIFGAME1){ + texture = game.ass.get(AssetDescriptors.BTN_WOOD); + } + else if (nextScreen==ScreenType.GAME2){ + texture = game.ass.get(AssetDescriptors.BTN_SAND); + } + else{ + texture = game.ass.get(AssetDescriptors.BTN_ROCK); + } final float xButton = this.game.viewport.getWorldWidth() / 2.5f; - this.next = new TextButtonBuilder(game, nextBtnLabel).withStyle(styleNextBtn).isVisible(true) - .withPosition(xButton, this.game.viewport.getWorldHeight() / 30f).withListener(new ChangeListener() { + this.next = new ImageTextButtonBuilder(game, nextBtnLabel) + .withFontStyle(nextBtnFont) + .withImageStyle(texture) + .withPadding(Padding.STANDARD) + .isVisible(true) + .withPosition(xButton, this.game.viewport.getWorldHeight() / 30f) + .withListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { if(!nextImage()) { @@ -129,8 +148,13 @@ public void changed(ChangeEvent event, Actor actor) { Gdx.input.vibrate(vibrationTime / 4); } }).build(); - this.finish = new TextButtonBuilder(game, finishBtnLabel).withStyle(styleFinishBtn).isVisible(false) - .withPosition(xButton, this.game.viewport.getWorldHeight() / 2f).withListener(new ChangeListener() { + this.finish = new ImageTextButtonBuilder(game, finishBtnLabel) + .withFontStyle(finishBtnFont) + .withImageStyle(texture) + .withPadding(Padding.STANDARD) + .isVisible(false) + .withPosition(xButton, this.game.viewport.getWorldHeight() / 30f) + .withListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { Gdx.input.vibrate(vibrationTime); @@ -145,8 +169,28 @@ public void run() { } }).build(); + this.previous = new ImageTextButtonBuilder(game, previousBtnLabel) + .withFontStyle(previousBtnFont) + .withImageStyle(texture) + .withPadding(Padding.STANDARD) + .isVisible(false) + .withPosition(game.viewport.getWorldWidth() * 0.02f, this.game.viewport.getWorldHeight() / 30f) + .withListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + if(!previousImage()) { + // In the case when the image queue is empty (is == null or we saw every image) + previous.setVisible(false); + Gdx.input.vibrate(vibrationTime); + endSound.play(); + resetScreen(); + } + } + }).build(); + this.stage.addActor(this.next); this.stage.addActor(this.finish); + this.stage.addActor(this.previous); } private void loadAssets(AssetDescriptor changeOfImageSound, AssetDescriptor endSound, @@ -183,6 +227,7 @@ public CinematicScreen(final Kapotopia game, Stage stage) { this.pauseSound = null; this.next = null; this.finish = null; + this.previous = null; } /** @@ -194,20 +239,46 @@ protected void applyBundle(ParameterBundleBuilder params) { params.getLabels(), params.getLabelsBigList(), params.getFond(), params.getChangeOfImageSound(), params.getEndSound(), params.getPauseSound(), params.getNextBtnLabel(), params.getFinishBtnLabel(), params.getNextBtnFont(), params.getFinishBtnFont(), + params.getPreviousBtnLabel(), params.getPreviousBtnFont(), params.getTimerScheduleTime(), params.getVibrationTime(), params.getWithFinishBtn()); initialized = true; } // Regular functions + /** + * Show the previous image in the queue. Return false if there are no previous image. + * @return false if no previous image in the queue. True otherwise. + */ + public boolean previousImage() { + if (curImg <= 0) return false; + setElementVisibility(false,curImg); + setElementVisibility(true, --curImg); + changeOfImageSound.play(); + if (curImg == 0){ previous.setVisible(false); } + if (curImg == sequence.getSize()-2){ + finish.setVisible(false); + next.setVisible(true); + } + return true; + } + /** * Show the next image in the queue. If the queue is null or is empty, return false * @return false if the queue is null, or if is empty. True otherwise */ public boolean nextImage() { + previous.setVisible(true); if(sequence != null) { // We hide the current element setElementVisibility(false, curImg); + if (curImg == sequence.getSize() -2){ + setElementVisibility(true, ++curImg); + next.setVisible(false); + finish.setVisible(true); + changeOfImageSound.play(); + return true; + } if (curImg < sequence.getSize()-1) { // We make the next element visible setElementVisibility(true, ++curImg); @@ -228,6 +299,7 @@ public boolean nextImage() { */ public void resetScreen() { curImg = 0; + previous.setVisible(false); if(sequence != null) { Iterator iterator = sequence.iterator(); @@ -336,8 +408,10 @@ public class ParameterBundleBuilder { private AssetDescriptor pauseSound; private String nextBtnLabel; private String finishBtnLabel; + private String previousBtnLabel; private Font nextBtnFont; private Font finishBtnFont; + private Font previousBtnFont; private float timerScheduleTime; private int vibrationTime; private boolean withFinishBtn; @@ -352,10 +426,14 @@ public ParameterBundleBuilder(ScreenType nextScreen) { this.changeOfImageSound = AssetDescriptors.SOUND_JUMP_V1; this.endSound = AssetDescriptors.SOUND_GAMESTART; this.pauseSound = AssetDescriptors.SOUND_PAUSE; - this.nextBtnLabel = "Next"; - this.finishBtnLabel = "Play"; - this.nextBtnFont = FontHelper.CLASSIC_SANS_NORMAL_BLACK; - this.finishBtnFont = FontHelper.CLASSIC_SANS_NORMAL_BLACK; + + this.nextBtnLabel = game.loc.getString("next_button"); + this.finishBtnLabel = game.loc.getString("play_button"); + this.previousBtnLabel = game.loc.getString("previous_button"); + + this.nextBtnFont = null; + this.finishBtnFont = null; + this.previousBtnFont = null; this.timerScheduleTime = 2f; this.vibrationTime = 200; this.withFinishBtn = true; @@ -416,6 +494,11 @@ public ParameterBundleBuilder withFinishBtnTxt(String finishBtnTxt) { return this; } + public ParameterBundleBuilder withPreviousBtnTxt(String previousBtnTxt) { + this.previousBtnLabel = previousBtnTxt; + return this; + } + public ParameterBundleBuilder withNextBtnStyle(Font nextBtnFont) { this.nextBtnFont = nextBtnFont; return this; @@ -426,6 +509,11 @@ public ParameterBundleBuilder withFinishBtnStyle(Font finishBtnFont) { return this; } + public ParameterBundleBuilder withPreviousBtnStyle(Font previousBtnFont) { + this.previousBtnFont = previousBtnFont; + return this; + } + public ParameterBundleBuilder withTimerScheduleTime(float timerScheduleTime) { this.timerScheduleTime = timerScheduleTime; return this; @@ -485,13 +573,15 @@ public String getFinishBtnLabel() { return finishBtnLabel; } + public String getPreviousBtnLabel() { return previousBtnLabel; } + public Font getNextBtnFont() { return nextBtnFont; } - public Font getFinishBtnFont() { - return finishBtnFont; - } + public Font getFinishBtnFont() { return finishBtnFont; } + + public Font getPreviousBtnFont() {return previousBtnFont; } public float getTimerScheduleTime() { return timerScheduleTime; diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/Game1.java b/kapotopia/core/src/gdx/kapotopia/Screens/Game1.java index 7371dbf..c4761ed 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/Game1.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/Game1.java @@ -3,9 +3,13 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.utils.TimeUtils; +import com.badlogic.gdx.utils.Timer; import java.util.HashSet; import java.util.List; @@ -16,6 +20,8 @@ import gdx.kapotopia.Game1.RenderController; import gdx.kapotopia.Game1.SoundController; import gdx.kapotopia.Game1.VirusContainer; +import gdx.kapotopia.Helpers.Builders.ImageBuilder; +import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; import gdx.kapotopia.Kapotopia; public class Game1 implements Screen, MireilleListener { @@ -179,6 +185,21 @@ public void scoreChanged(int score) { gameController.scoreChanged(score); } + @Override + public void caughtNotSTD(boolean c) { + if (c) { + Texture red = game.ass.get(AssetDescriptors.Failed); + final Image r = new ImageBuilder().withTexture(red).build(); + stage.addActor(r); + Timer.schedule(new Timer.Task() { + @Override + public void run() { + r.remove(); + } + }, 0.15f); //Manon Lost + } + } + /* ******************************************** * G E T C O N T R O L L E R S * ******************************************** */ diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/Game2.java b/kapotopia/core/src/gdx/kapotopia/Screens/Game2.java index b011403..f2a1c9b 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/Game2.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/Game2.java @@ -10,10 +10,13 @@ import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.InputListener; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.utils.TimeUtils; @@ -26,10 +29,12 @@ import gdx.kapotopia.Helpers.Alignement; import gdx.kapotopia.Helpers.Builders.ImageTextButtonBuilder; import gdx.kapotopia.Helpers.Builders.LabelBuilder; +import gdx.kapotopia.Helpers.Builders.TextButtonBuilder; import gdx.kapotopia.Helpers.SimpleDirectionGestureDetector; import gdx.kapotopia.Helpers.StandardInputAdapter; import gdx.kapotopia.Kapotopia; import gdx.kapotopia.Localisation; +import gdx.kapotopia.ScreenType; import static java.util.Collections.shuffle; @@ -112,6 +117,24 @@ public Game2(final Kapotopia game){ this.stage.addActor(palmier); this.stage.addActor(panneau); + final TextButton quitBtn = new TextButtonBuilder(game, game.loc.getString("exit_button")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(game.viewport.getWorldWidth() * 0.02f, this.game.viewport.getWorldHeight()*0.9f) + .build(); + quitBtn.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, + int pointer, int button) { + + game.changeScreen(ScreenType.WORLD1); + game.destroyScreen(ScreenType.GAME2); + + return true; + } + + }); + + this.stage.addActor(quitBtn); middleX = screenWidth/3; middleY = screenHeight /2; @@ -136,7 +159,7 @@ public Game2(final Kapotopia game){ sympTextSize = screenWidth/2; livesLabel = new LabelBuilder(game, loc.getString("lives_label")+lives) - .withStyle(FontHelper.CLASSIC_BOLD_NORMAL_BLACK).isVisible(true).withPosition(livesX,livesY).build(); + .withStyle(FontHelper.CLASSIC_BOLD_NORMAL_WHITE).isVisible(true).withPosition(livesX,livesY).build(); stage.addActor(livesLabel); //Symptoms creation and set up (representation of symptoms) @@ -420,6 +443,16 @@ public void onDown() { } + @Override + public void onTouch() { + + } + + @Override + public void onPan() { + + } + /** * Change the symptom that is displayed and considered current * @param left: boolean that indicates in what direction the change needs to be done diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/Game3.java b/kapotopia/core/src/gdx/kapotopia/Screens/Game3.java index b406b7f..08e546e 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/Game3.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/Game3.java @@ -17,6 +17,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.utils.TimeUtils; +import java.util.ArrayList; import java.util.Random; import gdx.kapotopia.AssetsManaging.AssetDescriptors; @@ -27,6 +28,7 @@ import gdx.kapotopia.Helpers.Builders.PopUpBuilder; import gdx.kapotopia.Helpers.Builders.TextButtonBuilder; import gdx.kapotopia.Kapotopia; +import gdx.kapotopia.Languages; import gdx.kapotopia.ScreenType; public class Game3 implements Screen { @@ -107,11 +109,11 @@ private void loadAssets() { public Core getCore(){return core;} - public void back(){ + public void back(ArrayList list){ if(core.playerSucceeded()) { this.successSound.play(); } - quitGameConfirm(); + quitGameConfirm(list); } public final Kapotopia getGame(){ return game; @@ -174,13 +176,40 @@ public void dispose() { stage.dispose(); } - public void quitGameConfirm() { + public void quitGameConfirm(ArrayList list) { final PopUpBuilder popup = new PopUpBuilder(game, popStage); - popup.setTitle("Congratulations!"); + String title = game.loc.getString("congrats_msg"); + if (!list.isEmpty()){ + title += "\n" + game.loc.getString("mistake_msg"); + for (String e : list){ + title += "\n"+ game.loc.getString(e); + } + } + + popup.setTitle(title); - TextButton btnYes = new TextButtonBuilder(game, "Exit").withStyle(FontHelper.AESTHETIC_NORMAL_BLACK).build(); + + + TextButton btnReplay = new TextButtonBuilder(game, game.loc.getString("restart_button")).withStyle(FontHelper.AESTHETIC_NORMAL_WHITE).build(); + btnReplay.addListener(new InputListener() { + @Override + public boolean touchDown(InputEvent event, float x, float y, + int pointer, int button) { + + // Do whatever here for exit button + popup.close(); + + game.destroyScreen(ScreenType.GAME3); + game.changeScreen(ScreenType.GAME3); + + return true; + } + + }); + + TextButton btnYes = new TextButtonBuilder(game, game.loc.getString("exit_button")).withStyle(FontHelper.AESTHETIC_NORMAL_WHITE).build(); btnYes.addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, @@ -196,7 +225,8 @@ public boolean touchDown(InputEvent event, float x, float y, } }); - + + popup.addButton(btnReplay); popup.addButton(btnYes); popup.setPosition(0,50); popup.show(); @@ -207,7 +237,7 @@ public void LockPopUp(String description) { popup.setTitle(description); - TextButton btnYes = new TextButtonBuilder(game, "back").withStyle(FontHelper.AESTHETIC_NORMAL_BLACK).build(); + TextButton btnYes = new TextButtonBuilder(game, game.loc.getString("back_button")).withStyle(FontHelper.AESTHETIC_NORMAL_WHITE).build(); btnYes.addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, @@ -225,4 +255,5 @@ public boolean touchDown(InputEvent event, float x, float y, popup.show(); } + } diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/Game4.java b/kapotopia/core/src/gdx/kapotopia/Screens/Game4.java new file mode 100644 index 0000000..0891354 --- /dev/null +++ b/kapotopia/core/src/gdx/kapotopia/Screens/Game4.java @@ -0,0 +1,370 @@ +package gdx.kapotopia.Screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Input; +import com.badlogic.gdx.InputAdapter; +import com.badlogic.gdx.InputMultiplexer; +import com.badlogic.gdx.Screen; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.OrthographicCamera; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.EventListener; +import com.badlogic.gdx.scenes.scene2d.InputEvent; +import com.badlogic.gdx.scenes.scene2d.InputListener; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; +import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; +import com.badlogic.gdx.utils.TimeUtils; +import com.badlogic.gdx.utils.viewport.FitViewport; +import com.badlogic.gdx.utils.viewport.Viewport; + +import gdx.kapotopia.AssetsManaging.AssetDescriptors; +import gdx.kapotopia.Fonts.FontHelper; +import gdx.kapotopia.Fonts.Font; +import gdx.kapotopia.Game4.GameState; +import gdx.kapotopia.GameConfig; +import gdx.kapotopia.Helpers.Alignement; +import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; +import gdx.kapotopia.Helpers.Builders.LabelBuilder; +import gdx.kapotopia.Helpers.Builders.ImageTextButtonBuilder; +import gdx.kapotopia.Helpers.Padding; +import gdx.kapotopia.Kapotopia; + +import com.badlogic.gdx.scenes.scene2d.Stage; + +import gdx.kapotopia.Languages; +import gdx.kapotopia.Localisation; +import gdx.kapotopia.ScreenType; + + +public class Game4 implements Screen { + + private Kapotopia game; + private Stage stage; + private Localisation loc; + + private float screenWidth; + private float screenHeight; + private ImageButton pauseIcon; + private ImageTextButton quitBtn; + private ImageTextButton pauseBtn; + private ImageTextButton legendBtn; + private ImageTextButton returnBtn; + private Image legendImg; + private final float BTN_SPACING = 90f; + private Font normalFont; + + private Texture arrow1, arrow2, arrow3, arrow4; + + private Label scoreLabel; + + private final String TAG = this.getClass().getSimpleName(); + private GameState gameState; + + private OrthographicCamera camera; + + public Game4(final Kapotopia game) { + this.game = game; + this.loc = game.loc; + + screenWidth = game.viewport.getWorldWidth(); + screenHeight = game.viewport.getWorldHeight(); + this.normalFont = FontHelper.CLASSIC_SANS_NORMAL_WHITE; + + this.camera = new OrthographicCamera(screenWidth, screenHeight); + game.viewport.setCamera(camera); + + game.getSettings().setIntro_4_skip(true); + + loadAssets(); + + this.arrow1 = game.ass.get(AssetDescriptors.RIGHT_ARROW4); + this.arrow2 = game.ass.get(AssetDescriptors.DOWN_ARROW4); + this.arrow3 = game.ass.get(AssetDescriptors.LEFT_ARROW4); + this.arrow4 = game.ass.get(AssetDescriptors.UP_ARROW4); + + + ImageButton rightArrow = new ImageButtonBuilder() + .withImageUp(arrow1) + .withPosition(screenWidth/2 + 125, screenHeight/11) + .withListener(new InputListener() { + public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { + setDirection(1); + return true; + } + }) + .build(); + + ImageButton downArrow = new ImageButtonBuilder() + .withImageUp(arrow2) + .withPosition(screenWidth/2 -31, screenHeight/20 - 20) + .withListener(new InputListener() { + public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { + setDirection(2); + return true; + } + }) + .build(); + + ImageButton leftArrow = new ImageButtonBuilder() + .withImageUp(arrow3) + .withPosition(screenWidth/3 - 50, screenHeight/11) + .withListener(new InputListener() { + public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { + setDirection(3); + return true; + } + }) + .build(); + + ImageButton upArrow = new ImageButtonBuilder() + .withImageUp(arrow4) + .withPosition(screenWidth/2 - 31, screenHeight/7 + 10) + .withListener(new InputListener() { + public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { + setDirection(0); + return true; + } + }) + .build(); + + + Image background = new Image(game.ass.get(AssetDescriptors.BACKGROUND_GAME4)); + + if (game.loc.getChosenLanguage() == Languages.FRENCH){ + this.legendImg = new Image(game.ass.get(AssetDescriptors.LEGEND_FR)); + } + else{ + this.legendImg = new Image(game.ass.get(AssetDescriptors.LEGEND_EN)); + } + this.legendImg.setVisible(false); + + this.stage = new Stage(game.viewport); + this.stage.addActor(background); + this.stage.addActor(rightArrow); + this.stage.addActor(downArrow); + this.stage.addActor(leftArrow); + this.stage.addActor(upArrow); + + + + gameState = new GameState(game, this); + + // Buttons + final Game4 dis = this; + this.pauseIcon = new ImageButtonBuilder().withImageUp(game.ass.get(AssetDescriptors.PAUSE_LOGO)) + .withImageChecked(game.ass.get(AssetDescriptors.PLAY_LOGO)) + .withImageDown(game.ass.get(AssetDescriptors.PAUSE_LOGO)) + .withBounds(gameState.getBounds().width - (screenWidth / 5f), + gameState.getBounds().height - (screenHeight / 10f), screenWidth / 7.2f, screenHeight / 25f) + .withListener(new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if(gameState.isPaused()) { + dis.pauseIcon.setChecked(false); + resumeFromPause(); + }else{ + dis.pauseIcon.setChecked(true); + pause(); + } + } + }).build(); + stage.addActor(pauseIcon); + + EventListener quitEvent = new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + game.getMusicControl().stopMusic(); + game.destroyScreen(ScreenType.GAME4); + game.destroyScreen(ScreenType.WORLD2); + game.changeScreen(ScreenType.WORLD2); + } + }; + + EventListener pauseEvent = new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if(gameState.isPaused()) { + pauseIcon.setChecked(false); + resumeFromPause(); + } else { + pauseIcon.setChecked(true); + pause(); + } + Gdx.app.debug(TAG, "pauseLabel clicked - isPaused is " + gameState.isPaused()); + } + }; + + EventListener legendEvent = new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if(gameState.isPaused()) { + legendImg.setVisible(true); + returnBtn.setVisible(true); + pauseBtn.setVisible(false); + } + Gdx.app.debug(TAG, "pauseLabel clicked - isPaused is " + gameState.isPaused()); + } + }; + + EventListener returnEvent = new ClickListener() { + @Override + public void clicked(InputEvent event, float x, float y) { + if(gameState.isPaused()) { + legendImg.setVisible(false); + returnBtn.setVisible(false); + pauseBtn.setVisible(true); + } + Gdx.app.debug(TAG, "pauseLabel clicked - isPaused is " + gameState.isPaused()); + } + }; + + quitBtn = new ImageTextButtonBuilder(game, loc.getString("quit_button_text")) + .withFontStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withAlignment(Alignement.CENTER) + .withY((gameState.getBounds().getHeight() / 2) - 2*BTN_SPACING) + .withPadding(Padding.STANDARD) + .withListener(quitEvent) + .withImageStyle(game.ass.get(AssetDescriptors.BTN_ROCK)) + .isVisible(false) + .build(); + + pauseBtn = new ImageTextButtonBuilder(game, loc.getString("continue_button")) + .withFontStyle(normalFont).withAlignment(Alignement.CENTER) // faut rajouter le x + .withY(gameState.getBounds().height / 2) + .isVisible(false) + .withImageStyle(game.ass.get(AssetDescriptors.BTN_ROCK)) + .withPadding(Padding.STANDARD) + .withListener(pauseEvent) + .build(); + + legendBtn = new ImageTextButtonBuilder(game, loc.getString("legend_button")) + .withFontStyle(normalFont).withAlignment(Alignement.CENTER) + .withY((gameState.getBounds().getHeight() / 2) - BTN_SPACING) + .isVisible(false) + .withImageStyle(game.ass.get(AssetDescriptors.BTN_ROCK)) + .withPadding(Padding.STANDARD) + .withListener(legendEvent) + .build(); + + returnBtn = new ImageTextButtonBuilder(game, loc.getString("previous_button")) + .withFontStyle(normalFont) + .withPosition(screenWidth - 230, (gameState.getBounds().getHeight()) - BTN_SPACING) + .isVisible(false) + .withImageStyle(game.ass.get(AssetDescriptors.BTN_ROCK)) + .withPadding(Padding.STANDARD) + .withListener(returnEvent) + .build(); + + stage.addActor(quitBtn); + stage.addActor(pauseBtn); + stage.addActor(legendBtn); + + scoreLabel = new LabelBuilder(game, game.loc.getString("score2_label") + gameState.getTotalScore()).withStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withPosition(50, screenHeight - 120).build(); + this.stage.addActor(scoreLabel); + this.stage.addActor(legendImg); + stage.addActor(returnBtn); + } + + private void setDirection(int nextDirection){ + this.gameState.setDirection(nextDirection); + } + + private void loadAssets() { + long startTime = TimeUtils.millis(); + + game.ass.finishLoading(); + Gdx.app.log(TAG, game.ass.getDiagnostics()); + Gdx.app.log(TAG, "Elapsed time for loading assets : " + TimeUtils.timeSinceMillis(startTime) + " ms"); + } + + public void updateWhenResumeFromPause() { + pauseBtn.setVisible(false); + quitBtn.setVisible(false); + legendBtn.setVisible(false); + } + + public void updateAtPause() { + pauseBtn.setVisible(true); + quitBtn.setVisible(true); + legendBtn.setVisible(true); + } + + @Override + public void show() { + InputMultiplexer iM = new InputMultiplexer(); + iM.addProcessor(new InputAdapter() { + @Override + public boolean keyDown(int keycode) { + if (keycode == Input.Keys.BACK) { + game.destroyScreen(ScreenType.GAME4); + game.changeScreen(ScreenType.WORLD2); + return true; + } + return false; + } + }); + iM.addProcessor(stage); + Gdx.input.setInputProcessor(iM); + game.getMusicControl().playMusic(); + } + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(0, 0, 0, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + camera.update(); + + scoreLabel.setText(game.loc.getString("score2_label") + gameState.getTotalScore()); + + stage.act(Gdx.graphics.getDeltaTime()); + stage.draw(); + + gameState.update(delta, game.viewport); + gameState.draw(screenWidth, screenHeight, camera); + + } + + @Override + public void resize(int width, int height) { + game.viewport.update(width, height); + } + + @Override + public void pause() { + updateAtPause(); + gameState.updateOnPause(); + game.getMusicControl().pauseMusic(); + Gdx.app.debug(TAG, "game paused - isPaused is true"); + } + @Override + public void resume() { + gameState.updateOnResume(); + game.getMusicControl().playMusic(); + Gdx.app.debug(TAG, "game resumed - isPaused is false"); + } + public void resumeFromPause() { + updateWhenResumeFromPause(); + gameState.resumeFromPause(); + game.getMusicControl().playMusic(); + } + + @Override + public void hide() { + + } + + @Override + public void dispose() { + stage.dispose(); + } + + public Stage getStage() { + return stage; + } +} diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/IntroCutscene.java b/kapotopia/core/src/gdx/kapotopia/Screens/IntroCutscene.java index a32acab..d1ba88f 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/IntroCutscene.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/IntroCutscene.java @@ -109,7 +109,7 @@ public IntroCutscene(Kapotopia game) { stateTime = 0f; applyBundle(new ParameterBundleBuilder(ScreenType.MAINMENU).withImages(images).withLabels(labels) - .withFinishBtn(false).withNextBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE)); + .withFinishBtn(false).withNextBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE).withFinishBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE).withPreviousBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE)); } @Override diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/MainMenu.java b/kapotopia/core/src/gdx/kapotopia/Screens/MainMenu.java index b00f6c9..534f477 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/MainMenu.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/MainMenu.java @@ -10,9 +10,13 @@ import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.scenes.scene2d.InputListener; import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; +import com.badlogic.gdx.scenes.scene2d.utils.Drawable; +import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import gdx.kapotopia.Animations.NeonDoorAnimation; import gdx.kapotopia.AssetsManaging.AssetDescriptors; @@ -20,6 +24,8 @@ import gdx.kapotopia.Fonts.FontHelper; import gdx.kapotopia.GameConfig; import gdx.kapotopia.Helpers.Alignement; +import gdx.kapotopia.Helpers.AnimatedDrawable; +import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; import gdx.kapotopia.Helpers.Builders.LabelBuilder; import gdx.kapotopia.Helpers.Builders.TextButtonBuilder; import gdx.kapotopia.Helpers.ChangeScreenListener; @@ -61,10 +67,12 @@ public MainMenu(final Kapotopia game) { this.backgroundBatch = new SpriteBatch(); stateTime = 0f; - this.part_1 = game.ass.get(AssetDescriptors.MM_PART1); + this.part_1 = game.ass.get(AssetDescriptors.MM_PART1_CUT); this.part_2 = new NeonDoorAnimation(game, Animation.PlayMode.LOOP_RANDOM).getAnimation(); - this.part_3 = game.ass.get(AssetDescriptors.MM_PART3); - this.part_4 = game.ass.get(AssetDescriptors.MM_PART4); + this.part_3 = game.ass.get(AssetDescriptors.MM_PART3_CUT); + this.part_4 = game.ass.get(AssetDescriptors.MM_PART4_CUT); + + // Import sounds this.pauseSound = game.ass.get(AssetDescriptors.SOUND_PAUSE); @@ -75,30 +83,59 @@ public MainMenu(final Kapotopia game) { //setup Button final float x = game.viewport.getWorldWidth() / 2.6f; final float y = game.viewport.getWorldHeight(); - final TextButton world1 = new TextButtonBuilder(game, game.loc.getString("text_world1")) + + ImageButton imageBtnToWorld1 = new ImageButtonBuilder() + .withImageUp(part_1) + .withListener(new ChangeScreenListener(game, ScreenType.WORLD1)) + .withBounds(0, (float) (2*game.viewport.getWorldHeight()/3)+15, game.viewport.getWorldWidth(), game.viewport.getWorldHeight()/3) + .build(); + final TextButton btnToWorld1 = new TextButtonBuilder(game, game.loc.getString("text_world1")) .withStyle(style) .withY(y * 0.75f).withAlignment(Alignement.CENTER) .withListener(new ChangeScreenListener(game, ScreenType.WORLD1)).build(); - final TextButton world2 = new TextButtonBuilder(game, game.loc.getString("text_world2")) + + ImageButton imageBtnToWorld2 = new ImageButton(new AnimatedDrawable(part_2)); + imageBtnToWorld2.addListener(new ChangeScreenListener(game, ScreenType.WORLD2)); + final TextButton btnToWorld2 = new TextButtonBuilder(game, game.loc.getString("text_world2")) .withStyle(style) .withY(y * 0.43f).withAlignment(Alignement.CENTER) .withListener(new ChangeScreenListener(game, ScreenType.WORLD2)).build(); - final TextButton world4 = new TextButtonBuilder(game, game.loc.getString("text_istdex")) + + final ImageButton imageBtnToWorld3 = new ImageButtonBuilder() + .withImageUp(part_3) + .withListener(new ChangeScreenListener(game, ScreenType.STIDEX)) + .withBounds(0, y*0.05f, game.viewport.getWorldWidth(), (float) (game.viewport.getWorldHeight()/3)) + .build(); + final TextButton btnToWorld3 = new TextButtonBuilder(game, game.loc.getString("text_istdex")) .withStyle(style) - .withY(y * 0.2f).withAlignment(Alignement.CENTER) + .withY(y * 0.12f).withAlignment(Alignement.CENTER) .withListener(new ChangeScreenListener(game, ScreenType.STIDEX)) .build(); - final TextButton optionsBtn = new TextButtonBuilder(game, "Options").withStyle(style).withPosition(x / 3, y * 0.01f) - .withListener(new ChangeScreenListener(game, ScreenType.OPTIONS)).build(); + + final ImageButton imageButtonToOptions = new ImageButtonBuilder() + .withImageUp(part_4) + .withListener(new ChangeScreenListener(game, ScreenType.OPTIONS)) + .build(); + final TextButton optionsBtn = new TextButtonBuilder(game, "Options") + .withStyle(style) + .withY(y*0.01f).withAlignment(Alignement.CENTER) + .withListener(new ChangeScreenListener(game, ScreenType.OPTIONS)) + .build(); Label version = new LabelBuilder(game, "v:" + GameConfig.VERSION_NAME + " | code:" + GameConfig.VERSION_CODE) .withStyle(FontHelper.AESTHETIC_TINY_BLACK).withPosition(15, 0).build(); + + //stage.addActor(imgFond); //add button to the scene - stage.addActor(world1); - stage.addActor(world2); - stage.addActor(world4); + stage.addActor(imageBtnToWorld2); //world 2 must be loaded first to avoid it overlapping the other 2 + stage.addActor(btnToWorld2); + stage.addActor(imageBtnToWorld1); + stage.addActor(btnToWorld1); + stage.addActor(imageBtnToWorld3); + stage.addActor(btnToWorld3); + stage.addActor(imageButtonToOptions); stage.addActor(optionsBtn); stage.addActor(version); } @@ -127,9 +164,9 @@ public void render(float delta) { backgroundBatch.begin(); backgroundBatch.draw(part_4, 0, 0); - backgroundBatch.draw(part_3, 0, 0); - backgroundBatch.draw(part_2.getKeyFrame(stateTime, true), 0, 0); - backgroundBatch.draw(part_1, 0, 0); + //backgroundBatch.draw(part_3, 0, 0); + //backgroundBatch.draw(part_2.getKeyFrame(stateTime, true), 0, 0); + //backgroundBatch.draw(part_1, 0, 0); backgroundBatch.end(); stage.act(delta); diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/STIDex.java b/kapotopia/core/src/gdx/kapotopia/Screens/STIDex.java index 31cbb04..cacd96f 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/STIDex.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/STIDex.java @@ -20,6 +20,7 @@ import gdx.kapotopia.AssetsManaging.AssetDescriptors; import gdx.kapotopia.Fonts.Font; import gdx.kapotopia.Fonts.FontHelper; +import gdx.kapotopia.GameConfig; import gdx.kapotopia.Helpers.Align; import gdx.kapotopia.Helpers.Alignement; import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; @@ -99,7 +100,7 @@ public STIDex(final Kapotopia game) { // Computing gameboy downscreen coordinates final float x1_x = ww * 0.075f; - final float x1_y = wh * 0.282f; + final float x1_y = wh * 0.255f; final float w1 = ww * 0.85f; //final float h1 = wh * 0.15f; @@ -116,6 +117,15 @@ public STIDex(final Kapotopia game) { displayedIstSprite.setTouchable(Touchable.enabled); stage.addActor(displayedIstSprite); + // Close button + Texture close = game.ass.get(AssetDescriptors.CLOSE); + final ImageButton imageButtonToOptions = new ImageButtonBuilder() + .withImageUp(close) + .withPosition(0, wh - close.getHeight()) + .withListener(new ChangeScreenListener(game, ScreenType.MAINMENU)) + .build(); + stage.addActor(imageButtonToOptions); + //right arrow ImageButton rightArrow = new ImageButtonBuilder().withImageUp(rightArrowT) @@ -124,7 +134,7 @@ public STIDex(final Kapotopia game) { public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { istIndex = (istIndex + 1) % data.length; nameLab.setText(data[istIndex].getName()); - Align.centerLabel(nameLab, Alignement.CENTER); + nameLab.setX(ww * 0.5f - nameLab.getText().length * GameConfig.ONE_CHAR_SMALL_WIDTH *0.75f); descriptionLab.setText(data[istIndex].getDescription()); updateSti(); return true; @@ -143,7 +153,7 @@ public boolean touchDown (InputEvent event, float x, float y, int pointer, int b istIndex = (istIndex - 1) % data.length; if (istIndex < 0) istIndex = data.length-1; // Circular list nameLab.setText(data[istIndex].getName()); - Align.centerLabel(nameLab, Alignement.CENTER); + nameLab.setX(ww * 0.5f - nameLab.getText().length * GameConfig.ONE_CHAR_SMALL_WIDTH *0.75f); descriptionLab.setText(data[istIndex].getDescription()); updateSti(); return true; @@ -155,7 +165,7 @@ public boolean touchDown (InputEvent event, float x, float y, int pointer, int b // label containing STI name nameLab = new LabelBuilder(game, data[istIndex].getName()).withY(wh * 0.625f) .withStyle(FontHelper.CLASSIC_SANS_MIDDLE_BLACK) - .withAlignment(Alignement.CENTER).build(); + .withX(ww * 0.5f - data[istIndex].getName().length() * GameConfig.ONE_CHAR_SMALL_WIDTH *0.75f).build(); stage.addActor(nameLab); // label containing the STI descriptionLab diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/World1.java b/kapotopia/core/src/gdx/kapotopia/Screens/World1.java index a67ddab..96a6a06 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/World1.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/World1.java @@ -5,13 +5,17 @@ import com.badlogic.gdx.Screen; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.NinePatch; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import gdx.kapotopia.AssetsManaging.AssetDescriptors; import gdx.kapotopia.Fonts.FontHelper; import gdx.kapotopia.Helpers.Alignement; +import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; import gdx.kapotopia.Helpers.Builders.TextButtonBuilder; import gdx.kapotopia.Helpers.ChangeScreenListener; import gdx.kapotopia.Helpers.StandardInputAdapter; @@ -28,9 +32,19 @@ public class World1 implements Screen { public World1(final Kapotopia game) { this.game = game; - Image imgFond = new Image(game.ass.get(AssetDescriptors.MM_W1)); + Texture imgFondGame1 = game.ass.get(AssetDescriptors.WORLD1_GAME1); + Texture imgFondGame2 = game.ass.get(AssetDescriptors.WORLD1_GAME2); + ImageButton imgGame1 = new ImageButtonBuilder() + .withImageUp(imgFondGame1) + .withListener(new ChangeScreenListener(game, ScreenType.MOCKUPG1)) + .withBounds(0, game.viewport.getWorldHeight()/2, game.viewport.getWorldWidth(), game.viewport.getWorldHeight()/2) + .build(); + ImageButton imgGame2 = new ImageButtonBuilder() + .withImageUp(imgFondGame2) + .withListener(new ChangeScreenListener(game, ScreenType.MOCKUPG2)) + .withBounds(0,0, game.viewport.getWorldWidth(), game.viewport.getWorldHeight()/2) + .build(); stage = new Stage(game.viewport); - stage.addActor(imgFond); // Import sounds this.pauseSound = game.ass.get(AssetDescriptors.SOUND_PAUSE); @@ -41,11 +55,12 @@ public World1(final Kapotopia game) { TextButton game1 = new TextButtonBuilder(game, loc.getString("game1_button")).withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) .withY(y * 0.57f).withAlignment(Alignement.CENTER) .withListener(new ChangeScreenListener(game, ScreenType.MOCKUPG1)).build(); - TextButton game2 = new TextButtonBuilder(game, loc.getString("game2_button")).withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + TextButton game2 = new TextButtonBuilder(game, loc.getString("game2_button")).withStyle(FontHelper.AESTHETIC_NORMAL_BLACK) .withY(y * 0.1f).withAlignment(Alignement.CENTER) .withListener(new ChangeScreenListener(game, ScreenType.MOCKUPG2)).build(); - stage.addActor(imgFond); + stage.addActor(imgGame1); + stage.addActor(imgGame2); stage.addActor(game1); stage.addActor(game2); } diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/World2.java b/kapotopia/core/src/gdx/kapotopia/Screens/World2.java index 32f10fa..a69f2e9 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/World2.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/World2.java @@ -5,16 +5,21 @@ import com.badlogic.gdx.Screen; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Button; import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.utils.Timer; import gdx.kapotopia.AssetsManaging.AssetDescriptors; import gdx.kapotopia.Fonts.FontHelper; +import gdx.kapotopia.Helpers.Alignement; +import gdx.kapotopia.Helpers.Builders.ImageButtonBuilder; import gdx.kapotopia.Helpers.Builders.TextButtonBuilder; +import gdx.kapotopia.Helpers.ChangeScreenListener; import gdx.kapotopia.Helpers.ImageHelper; import gdx.kapotopia.Helpers.StandardInputAdapter; import gdx.kapotopia.Kapotopia; @@ -31,31 +36,40 @@ public class World2 implements Screen { public World2(final Kapotopia game) { this.game = game; - Image imgFond = ImageHelper.getBackground(game.viewport,game.ass.get(AssetDescriptors.MM_W2)); - stage = new Stage(game.viewport); + Texture imgFondGame1 = game.ass.get(AssetDescriptors.MM1_W2); + Texture imgFondGame2 = game.ass.get(AssetDescriptors.COVER_GAME4); - stage.addActor(imgFond); + final Localisation loc = game.loc; this.gameStart = game.ass.get(AssetDescriptors.SOUND_GAMESTART); - float x = game.viewport.getWorldWidth() / 2.5f; - float y = game.viewport.getWorldHeight() / 4; - final Button play = new TextButtonBuilder(game, game.loc.getString("play_button")) - .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE).withPosition(x,y).withListener(new ChangeListener() { - @Override - public void changed(ChangeEvent event, Actor actor) { - gameStart.play(); - Timer.schedule(new Timer.Task() { - @Override - public void run() { - game.destroyScreen(ScreenType.WORLD2); - game.changeScreen(ScreenType.MOCKUPG3); - } - },0.1f); - } - }).build(); - - stage.addActor(play); + float x = game.viewport.getWorldWidth(); + float y = game.viewport.getWorldHeight(); + + final ImageButton imgButtonGame1 = new ImageButtonBuilder() + .withImageUp(imgFondGame1) + .withBounds(0, game.viewport.getWorldHeight()/2, game.viewport.getWorldWidth(), game.viewport.getWorldHeight()/2) + .withListener(new ChangeScreenListener(game, ScreenType.MOCKUPG3) {}).build(); + final Button btnGame1 = new TextButtonBuilder(game, loc.getString("game3_button")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withY(y*0.57f).withAlignment(Alignement.CENTER) + .withListener(new ChangeScreenListener(game,ScreenType.MOCKUPG3) {}).build(); + + final ImageButton imgButtonGame2 = new ImageButtonBuilder() + .withImageUp(imgFondGame2) + .withBounds(0,0, game.viewport.getWorldWidth(), game.viewport.getWorldHeight()/2) + .withListener(new ChangeScreenListener(game, ScreenType.MOCKUPG4) {}).build(); + final Button btnGame2 = new TextButtonBuilder(game, loc.getString("game4_button")) + .withStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withY(y*0.1f).withAlignment(Alignement.CENTER) + .withListener(new ChangeScreenListener(game, ScreenType.MOCKUPG4) {}).build(); + + stage = new Stage(game.viewport); + + stage.addActor(imgButtonGame1); + stage.addActor(btnGame1); + stage.addActor(imgButtonGame2); + stage.addActor(btnGame2); } @Override diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/mockupG1.java b/kapotopia/core/src/gdx/kapotopia/Screens/mockupG1.java index 9e8ae54..4240653 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/mockupG1.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/mockupG1.java @@ -211,7 +211,8 @@ public mockupG1(final Kapotopia game) { skipBtn = new ImageTextButtonBuilder(game, game.loc.getString("skip_button")) .withFontStyle(FontHelper.AESTHETIC_NORMAL_WHITE) .withPosition(game.viewport.getWorldWidth() * 0.75f, this.game.viewport.getWorldHeight() / 30f) - .withImageStyle(game.ass.get(AssetDescriptors.BTN_WOOD)).isVisible(true) + .withImageStyle(game.ass.get(AssetDescriptors.BTN_WOOD)) + .isVisible(true) .withPadding(Padding.STANDARD) .withListener(new ChangeListener() { @Override @@ -225,9 +226,18 @@ public void changed(ChangeEvent event, Actor actor) { /* ENDING */ applyBundle(new ParameterBundleBuilder(ScreenType.DIFGAME1) - .withImages(images).withFinishBtn(false) - .withNextBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE).withTimerScheduleTime(0).withLabels(labels)); + .withImages(images) + .withFinishBtn(false) + .withPreviousBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withFinishBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withNextBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withTimerScheduleTime(0) + .withLabels(labels)); getStage().addActor(skipBtn); + + // Setting up the music + game.getMusicControl().changeMusic(game.ass.get(AssetDescriptors.MUSIC_GAME1), 0, true); + game.getMusicControl().playMusic(); } @Override diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/mockupG2.java b/kapotopia/core/src/gdx/kapotopia/Screens/mockupG2.java index 5dd177c..1052c1b 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/mockupG2.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/mockupG2.java @@ -115,7 +115,7 @@ public mockupG2(final Kapotopia game) { }; // Skip button skipBtn = new ImageTextButtonBuilder(game, game.loc.getString("skip_button")) - .withFontStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withFontStyle(FontHelper.AESTHETIC_NORMAL_BLACK) .withPosition(game.viewport.getWorldWidth() * 0.75f, this.game.viewport.getWorldHeight() / 30f) .withImageStyle(game.ass.get(AssetDescriptors.BTN_SAND)).isVisible(true) .withPadding(Padding.STANDARD) @@ -132,9 +132,12 @@ public void changed(ChangeEvent event, Actor actor) { this.applyBundle(new ParameterBundleBuilder(ScreenType.GAME2) .withImages(images) .withNextBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_BLACK) + .withFinishBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_BLACK) + .withPreviousBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_BLACK) .withTimerScheduleTime(0) .withLabels(labels) - .withFinishBtn(false)); + .withFinishBtn(true) + ); getStage().addActor(skipBtn); diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/mockupG3.java b/kapotopia/core/src/gdx/kapotopia/Screens/mockupG3.java index 19a0ad7..2c11fca 100644 --- a/kapotopia/core/src/gdx/kapotopia/Screens/mockupG3.java +++ b/kapotopia/core/src/gdx/kapotopia/Screens/mockupG3.java @@ -44,11 +44,12 @@ public class mockupG3 extends CinematicScreen { public mockupG3(final Kapotopia game) { super(game, new Stage(game.viewport)); + Localisation loc = game.loc; final float ww = GameConfig.GAME_WIDTH; final float wh = GameConfig.GAME_HEIGHT; - Localisation loc = game.loc; + Font font = FontHelper.CLASSIC_SANS_NORMAL_BLACK; Bounds dialogBubbleBounds = Align.getDialogBubbleBounds(); @@ -189,7 +190,10 @@ public void changed(ChangeEvent event, Actor actor) { /* ENDING */ this.applyBundle(new ParameterBundleBuilder(ScreenType.GAME3) - .withImages(images).withLabels(labels).withFinishBtn(false).withNextBtnStyle(FontHelper.CLASSIC_BOLD_NORMAL_WHITE)); + .withImages(images).withLabels(labels) + .withFinishBtn(true).withNextBtnStyle(FontHelper.CLASSIC_BOLD_NORMAL_WHITE) + .withFinishBtnStyle(FontHelper.CLASSIC_BOLD_NORMAL_WHITE) + .withPreviousBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE)); getStage().addActor(skipBtn); diff --git a/kapotopia/core/src/gdx/kapotopia/Screens/mockupG4.java b/kapotopia/core/src/gdx/kapotopia/Screens/mockupG4.java new file mode 100644 index 0000000..40e5b97 --- /dev/null +++ b/kapotopia/core/src/gdx/kapotopia/Screens/mockupG4.java @@ -0,0 +1,155 @@ +package gdx.kapotopia.Screens; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.scenes.scene2d.Actor; +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; +import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; + +import gdx.kapotopia.AssetsManaging.AssetDescriptors; +import gdx.kapotopia.Fonts.Font; +import gdx.kapotopia.Fonts.FontHelper; +import gdx.kapotopia.GameConfig; +import gdx.kapotopia.Helpers.Align; +import gdx.kapotopia.Helpers.Alignement; +import gdx.kapotopia.Helpers.Bounds; +import gdx.kapotopia.Helpers.Builders.ImageBuilder; +import gdx.kapotopia.Helpers.Builders.ImageTextButtonBuilder; +import gdx.kapotopia.Helpers.Builders.LabelBuilder; +import gdx.kapotopia.Helpers.ImageHelper; +import gdx.kapotopia.Helpers.Padding; +import gdx.kapotopia.Kapotopia; +import gdx.kapotopia.Localisation; +import gdx.kapotopia.ScreenType; + +//import static gdx.kapotopia.ScreenType.GAME2; + +public class mockupG4 extends CinematicScreen { + + private ImageTextButton skipBtn; + + public mockupG4(final Kapotopia game) { + super(game, new Stage(game.viewport)); + final float ww = game.viewport.getWorldWidth(); + final float wh = game.viewport.getWorldHeight(); + final Localisation loc = game.loc; + Font font = FontHelper.CLASSIC_SANS_NORMAL_BLACK; + Bounds dialogBubbleBounds = Align.getDialogBubbleBounds(); + Bounds explicativeBubbleBounds = Align.getExplicativeBubbleBounds(); + Label[][] labels = new Label[][] { + { + new LabelBuilder(game, loc.getString("game4_diag1")) + .withStyle(font).withBounds(dialogBubbleBounds) + .isWrapped(true) + .build() + }, + { + new LabelBuilder(game, loc.getString("game4_diag2")) + .withStyle(font).withBounds(dialogBubbleBounds) + .isWrapped(true) + .build() + }, + { + new LabelBuilder(game, loc.getString("game4_diag3")) + .withStyle(font).withBounds(dialogBubbleBounds) + .isWrapped(true) + .build() + }, + { + new LabelBuilder(game, loc.getString("rules_title")) + .withStyle(FontHelper.CLASSIC_BOLD_BIG_BLACK).withAlignment(Alignement.CENTER) + .withY(wh - explicativeBubbleBounds.getTopPad()) + .build(), + new LabelBuilder(game, loc.getString("game4_rules")) + .withStyle(font).withBounds(explicativeBubbleBounds) + .isWrapped(true) + .build() + } + }; + final Image back = new Image(game.ass.get(AssetDescriptors.BACKGROUND_DISC)); + final Image mireilleHappy = new Image(game.ass.get(AssetDescriptors.MI_HAPPY)); + mireilleHappy.setScale(GameConfig.SCALLING_FACTOR_INTROS); + mireilleHappy.setPosition(ww / 4f, 0); + final Image mireilleSurprise = new Image(game.ass.get(AssetDescriptors.MI_SURPRISED)); + mireilleSurprise.setScale(GameConfig.SCALLING_FACTOR_INTROS); + mireilleSurprise.setPosition(ww / 4f, 0); + + final Image tom = new ImageBuilder().withTexture(game.ass.get(AssetDescriptors.GODIVA)) + .withPosition(ww * 0.075f, wh * 0.04f) + .build(); + tom.setScale(GameConfig.SCALLING_FACTOR_INTROS); + + final Image[][] images = { + { + back, + mireilleHappy, + new Image(game.ass.get(AssetDescriptors.BUBBLE_RIGHT)) + }, + { + back, + mireilleSurprise, + new Image(game.ass.get(AssetDescriptors.BUBBLE_RIGHT)) + }, + { + back, + tom, + new Image(game.ass.get(AssetDescriptors.BUBBLE_LEFT)) + }, + { + back, + tom, + new Image(game.ass.get(AssetDescriptors.BUBBLE_EXPL)) + } + }; + // Skip button + skipBtn = new ImageTextButtonBuilder(game, game.loc.getString("skip_button")) + .withFontStyle(FontHelper.AESTHETIC_NORMAL_WHITE) + .withPosition(game.viewport.getWorldWidth() * 0.75f, this.game.viewport.getWorldHeight() / 30f) + .withImageStyle(game.ass.get(AssetDescriptors.BTN_ROCK)).isVisible(true) + .withPadding(Padding.STANDARD) + .withListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + resetScreen(); + game.changeScreen(ScreenType.STDGAME4); + } + }) + .build(); + + + this.applyBundle(new ParameterBundleBuilder(ScreenType.STDGAME4) // changed from GAME4 + .withImages(images) + .withNextBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withFinishBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withPreviousBtnStyle(FontHelper.CLASSIC_SANS_NORMAL_WHITE) + .withTimerScheduleTime(0) + .withLabels(labels) + .withFinishBtn(false) + ); + + getStage().addActor(skipBtn); + + // Setting up the music + game.getMusicControl().changeMusic(game.ass.get(AssetDescriptors.MUSIC_GAME3), 0, true); + game.getMusicControl().playMusic(); + } + + @Override + public void show() { + setUpInputProcessor(); + + skipBtn.setVisible(game.getSettings().isIntro_4_skip()); + } + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(0, 0, 0, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + + getStage().act(Gdx.graphics.getDeltaTime()); + getStage().draw(); + } +} diff --git a/kapotopia/core/src/gdx/kapotopia/Settings.java b/kapotopia/core/src/gdx/kapotopia/Settings.java index b7e0345..43df5d7 100644 --- a/kapotopia/core/src/gdx/kapotopia/Settings.java +++ b/kapotopia/core/src/gdx/kapotopia/Settings.java @@ -26,6 +26,7 @@ public class Settings { private boolean intro_1_skip; private boolean intro_2_skip; private boolean intro_3_skip; + private boolean intro_4_skip; /* CONSTANTES */ private final String TAG = "k" + this.getClass().getSimpleName(); private final String GENERAL_SETTINGS_NAME = "general_settings"; @@ -38,6 +39,7 @@ public class Settings { private final String PREF_INTRO_1_SKIP = "intro_1_skip"; private final String PREF_INTRO_2_SKIP = "intro_2_skip"; private final String PREF_INTRO_3_SKIP = "intro_3_skip"; + private final String PREF_INTRO_4_SKIP = "intro_4_skip"; // Game 1 private final String PREF_UNLOCKED_LEVEL = "lvl-unlocked"; private final String PREF_HIGHSCORE = "highscore"; //TODO make an elaborate highscore system that can save and load multiple highscores instead of a single one @@ -130,6 +132,15 @@ private void initialize() { this.intro_3_skip = prefs_gen.getBoolean(PREF_INTRO_3_SKIP, false); } + if (!prefs_gen.contains(PREF_INTRO_4_SKIP)) { + prefs_gen.putBoolean(PREF_INTRO_4_SKIP, false); + intro_4_skip = false; + needChange = true; + } else { + this.intro_4_skip = prefs_gen.getBoolean(PREF_INTRO_4_SKIP, false); + } + + if(needChange) { prefs_gen.flush(); } @@ -280,6 +291,14 @@ public void setIntro_3_skip(boolean intro_3_skip) { this.intro_3_skip = intro_3_skip; } + public boolean isIntro_4_skip(){ return intro_4_skip; } + + public void setIntro_4_skip(boolean intro_4_skip){ + prefs_gen.putBoolean(PREF_INTRO_4_SKIP, intro_4_skip); + prefs_gen.flush(); + this.intro_4_skip = intro_4_skip; + } + public boolean isFirstCinematicShowed() { return firstCinematicShowed; }