diff --git a/app/assets/translations/en-US.json b/app/assets/translations/en-US.json index 5ad8f13..772a6dc 100644 --- a/app/assets/translations/en-US.json +++ b/app/assets/translations/en-US.json @@ -7,5 +7,6 @@ "next_level": "Next Level", "coming_soon": "Coming Soon!", "close": "Close", + "lanka_dahan_intro": "As the sun dipped below the horizon, casting an amber glow over the ancient city of Lanka, you, Fearless Hanuman, found yourself ensnared. Ravana, the ten-headed demon king, had captured you—the mighty ape warrior. His eyes gleamed with malice as he spoke:\n\n“कपीनां किल लाङ्गूलमिष्टं भवति भूषणम्।\nतदस्य दीप्यतां शीघ्रं तेन दग्धेन गच्छतु।।5.53.3।।”\n\nTranslation: “The tail of a monkey is dear to them. It is like an ornament to them. Set it blaze swiftly with fire, and let him go.”\n\nBut you are Hanuman—the wind-swift, the leaper of oceans, the loyal servant of Lord Rama. You have the blessings of Maa Sita. \nThe flames would dance upon your fur, but it is as cold as ice.\nAs your heart beats with courage, and mischief twinkled in your eyes. \nYou would turn Lanka into an inferno, a beacon of defiance.\nCross the sprawling city, avoid detection, and unleash the flames of retribution. \n\nRemember, Fearless Hanuman, you have but one chance. If captured, the level resets. The city awaits your wrath, and Lanka trembles in anticipation.\n\nNote: Inspired by the epic Ramayana, this game level is a fictional adaptation.", "win_message": "You have successfully destroyed Lanka!" } \ No newline at end of file diff --git a/app/assets/translations/hi-IN.json b/app/assets/translations/hi-IN.json index c8bb49e..34c3a7b 100644 --- a/app/assets/translations/hi-IN.json +++ b/app/assets/translations/hi-IN.json @@ -7,5 +7,6 @@ "next_level": "अगला अध्याय", "coming_soon": "जल्द ही आ रहा है", "close": "ठीक है", + "lanka_dahan_intro": "As the sun dipped below the horizon, casting an amber glow over the ancient city of Lanka, you, Fearless Hanuman, found yourself ensnared. Ravana, the ten-headed demon king, had captured you—the mighty ape warrior. His eyes gleamed with malice as he spoke:\n\n“कपीनां किल लाङ्गूलमिष्टं भवति भूषणम्।\nतदस्य दीप्यतां शीघ्रं तेन दग्धेन गच्छतु।।5.53.3।।”\n\nTranslation: “The tail of a monkey is dear to them. It is like an ornament to them. Set it blaze swiftly with fire, and let him go.”\n\nBut you are Hanuman—the wind-swift, the leaper of oceans, the loyal servant of Lord Rama. You have the blessings of Maa Sita. \nThe flames would dance upon your fur, but it is as cold as ice.\nAs your heart beats with courage, and mischief twinkled in your eyes. \nYou would turn Lanka into an inferno, a beacon of defiance.\nCross the sprawling city, avoid detection, and unleash the flames of retribution. \n\nRemember, Fearless Hanuman, you have but one chance. If captured, the level resets. The city awaits your wrath, and Lanka trembles in anticipation.\n\nNote: Inspired by the epic Ramayana, this game level is a fictional adaptation.", "win_message": "आपने लंका को सफलतापूर्वक दहन कर दिया है!" } \ No newline at end of file diff --git a/app/lib/game/game_engine.dart b/app/lib/game/game_engine.dart index acebc24..eb349e6 100644 --- a/app/lib/game/game_engine.dart +++ b/app/lib/game/game_engine.dart @@ -1,13 +1,3 @@ -/* -This file is responsible for creating the game engine and setting up the game. -It uses the Bonfire library to create the game engine and the game world. -It also sets up the player and the enemies in the game. It also sets up the -joystick and the camera for the game. It also sets up the background music for -the game. It also sets up the reset function for the game. The reset function is -hsed to reset the game when the player dies. The game engine is used in the game -screen to create the game world and the game engine. -*/ -/*MOVED IMPRESSIVE CODE SNIPPET to rakshasa.dart*/ import 'package:bonfire/bonfire.dart'; import 'package:flutter/foundation.dart'; import 'package:ramayana/user_prefs/audioController.dart'; @@ -20,15 +10,26 @@ import 'package:flutter/services.dart'; import 'dart:math'; import 'dart:ui' as ui; -// This implementation is based on the following chapter of the book "The Nature of Code" by Daniel Shiffman: -// https://natureofcode.com/autonomous-agents/ -// Also refer to Craig Reynolds' "Boids" algorithm, which simulates the flocking behavior of birds. -// In the context of the game, the boids are used to simulate the behavior of the enemies. -// For example, the Rakshasa enemies in the game can use this to simulate their flocking behavior. -// In general this is a better approach than using a simple pathfinding algorithm which directly calculates the path to the player. -// This gives a more natural and realistic behavior to the enemies. -// Also, avoids the enemies from getting stuck in obstacles or against each other. +/* +This file is responsible for creating the game engine and setting up the game. +It uses the Bonfire library to create the game engine and the game world. +It also sets up the player and the enemies in the game. It also sets up the +joystick and the camera for the game. It also sets up the background music for +the game. It also sets up the reset function for the game. The reset function is +hsed to reset the game when the player dies. The game engine is used in the game +screen to create the game world and the game engine. +I think, the boids algorithm below is pretty cool. + +This implementation is based on the following chapter of the book "The Nature of Code" by Daniel Shiffman: + https://natureofcode.com/autonomous-agents/ + Also refer to Craig Reynolds' "Boids" algorithm, which simulates the flocking behavior of birds. + In the context of the game, the boids are used to simulate the behavior of the enemies. + For example, the Rakshasa enemies in the game can use this to simulate their flocking behavior. + In general this is a better approach than using a simple pathfinding algorithm which directly calculates the path to the player. + This gives a more natural and realistic behavior to the enemies. + Also, avoids the enemies from getting stuck in obstacles or against each other. +*/ class Boid { static final Random r = Random(); static final Vec migrate = Vec(0.02, 0); diff --git a/app/lib/level_picker/world_selector.dart b/app/lib/level_picker/world_selector.dart index 0aced67..c014feb 100644 --- a/app/lib/level_picker/world_selector.dart +++ b/app/lib/level_picker/world_selector.dart @@ -44,7 +44,7 @@ class _WorldMapWidgetState extends State { double scale = side / 1000; print(scale); return Material( - color: Colors.red, + color: Colors.black, child: SingleChildScrollView( child: Container( width: side, @@ -59,19 +59,6 @@ class _WorldMapWidgetState extends State { child: Stack( alignment: Alignment.center, children: [ - // Container( - // width: side, - // height: side, - // decoration: BoxDecoration( - // color: Colors.green.withOpacity(0.3), - // image: DecorationImage( - // image: AssetImage('assets/worlds/world_map.png'), - // opacity: 0.3, - // fit: BoxFit.cover, - // alignment: Alignment.topLeft, - // ), - // ), - // ), ...worlds.map((e) => WorldTile( world: e, scale: scale, diff --git a/app/lib/main.dart b/app/lib/main.dart index 6468cf3..4b502a8 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -1,6 +1,8 @@ import 'package:bonfire/bonfire.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:ramayana/level_picker/world_selector.dart'; +import 'package:ramayana/title_screen/level_intro.dart'; import 'package:ramayana/title_screen/title_screen.dart'; import 'user_prefs/audioController.dart'; import 'game/game_engine.dart'; @@ -35,7 +37,9 @@ class RamayanRPGApp extends StatelessWidget { supportedLocales: context.supportedLocales, locale: context.locale, debugShowCheckedModeBanner: false, + // home: WorldMapWidget(locale: context.locale)); // home: GameEngine(level: 'lanka_dahan')); home: TitleScreen()); + // home: LevelIntro(level: 'lanka_dahan')); } } diff --git a/app/lib/title_screen/level_intro.dart b/app/lib/title_screen/level_intro.dart new file mode 100644 index 0000000..f58c3e8 --- /dev/null +++ b/app/lib/title_screen/level_intro.dart @@ -0,0 +1,47 @@ +import 'package:animated_text_kit/animated_text_kit.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:ramayana/game/game_engine.dart'; + +class LevelIntro extends StatelessWidget { + const LevelIntro({Key? key, required String level}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Material( + color: Colors.black, + child: SafeArea( + child: Stack( + children: [ + SingleChildScrollView( + child: Container( + padding: const EdgeInsets.all(20), + child: AnimatedTextKit( + isRepeatingAnimation: false, + animatedTexts: [ + TypewriterAnimatedText('lanka_dahan_intro'.tr(), + textStyle: const TextStyle( + fontSize: 14, + color: Colors.white, + fontWeight: FontWeight.bold)), + ])), + ), + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: const EdgeInsets.only(bottom: 20), + child: ElevatedButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + GameEngine(level: 'lanka_dahan'))), + child: Text('start_game'.tr())), + ), + ), + ], + ), + ), + ); + } +} diff --git a/app/lib/title_screen/title_screen.dart b/app/lib/title_screen/title_screen.dart index 5beba27..2b4dd7b 100644 --- a/app/lib/title_screen/title_screen.dart +++ b/app/lib/title_screen/title_screen.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:ramayana/game/game_engine.dart'; import 'package:ramayana/level_picker/world_selector.dart'; import 'package:ramayana/title_screen/language_picker.dart'; +import 'package:ramayana/title_screen/level_intro.dart'; import 'package:ramayana/user_prefs/audioController.dart'; import 'package:video_player/video_player.dart'; @@ -82,7 +83,8 @@ class _TitleScreenState extends State { context, MaterialPageRoute( builder: (context) => - const GameEngine(level: 'lanka_dahan'))), + LevelIntro(level: 'lanka_dahan'))), + // const GameEngine(level: 'lanka_dahan'))), child: Text('start_game'.tr())), ], ), diff --git a/app/pubspec.yaml b/app/pubspec.yaml index e854cc1..12f929a 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.34+34 +version: 1.0.45+45 environment: sdk: ">=3.2.3 <4.0.0"