RafaelBarbosatec / bonfire

(RPG maker) Create RPG-style or similar games more simply with Flame.
https://bonfire-engine.github.io
MIT License
1.21k stars 186 forks source link

[question]: Custom Transition Animations and Position Shifting in WorldMapByTiled #553

Open shingo-nakanishi opened 2 weeks ago

shingo-nakanishi commented 2 weeks ago

How can we help?

I was able to implement screen transitions using WorldMapByTiled. Reference: https://qiita.com/KAZMA_WED/items/c1d33ff4dcd293ade1af

Questions:

RafaelBarbosatec commented 2 weeks ago

Hi @shingo-nakanishi ! This is a incredible tutorial. I don't knew about that. Thanks for sharing.

So, if you can move you player to other position of the map and adds some animation you can use the lighting resources adds a black animation while you move your player. Like this:

gameRef.lighting.animateToColor(Colors.black);

And after move :

gameRef.lighting.animateToColor(Colors.transparent);

Other way is using the flutter resources. For example, you can criar a dialog that do a face in and fade out in a black screen, then you can show this dialog and move you player.

If you are call another screen (other widget with BonfireWidget) you can use de flutter screen transaction too.

I hope this can help you ☺️

shingo-nakanishi commented 2 weeks ago

@RafaelBarbosatec

It was a good article. Thanks to this article, I was able to get a good grasp of the concept. It seems that WorldMapByTiled only needs to receive the next map as shown below.

WorldMapByTiled(
        TiledAssetReader(asset: 'maps/map01.tmj'),
        forceTileSize: Vector2(tileSize, tileSize),
        objectsBuilder: {
          'bottomExitSensor': (properties) => ExitMapSensor(
                position: properties.position,
                size: properties.size,
                nextMap: const HalloweenMap02(), // 👈👈👈
              ),
        },
        ...
)

Where should I place gameRef.lighting.animateToColor(Colors.black); ?

RafaelBarbosatec commented 2 weeks ago

Humm. In this case, a I recommend you create an other widget with your BonfireWidget and your configurations like map ,enemies, etc. This way you can use the flutter navigation: Navigator.of(context).pushNamed('/other-map')

Or you can use the same widget but passing arguments de configurations of map, enemies, etc.

Take a look this example:

https://github.com/RafaelBarbosatec/bonfire/tree/develop/example%2Flib%2Fpages%2Fmini_games%2Fmulti_scenario

You can test this example in the bonfire demo. Select in the menu Mini Games-> Multi Scenarios game:

https://bonfire-engine.github.io/examples/bonfire-v3/

shingo-nakanishi commented 2 weeks ago

@RafaelBarbosatec

I tried the following, but it resulted in an error.(I moved the character to the right edge.) https://bonfire-engine.github.io/examples/bonfire-v3/

Screenshot 2024-08-25 at 7 58 52
RafaelBarbosatec commented 2 weeks ago

I'll look it. But take a look the code to get a idea