Birds flying across the map - how to do it best?

I wanted to do this for a while: Birds or bats flying across the screen and disappearing again. Or birds walking on foot, then flying away when you approach them.


What is the best way to handle this? How do you guys do yours?
following cause i wonder the same thing
I was thinking, show picture events, but I want to see if anyone comes up with something better
I would do a bird and 4 events surrounding the bird that always follow it, like bird X1 (left to the bird) bird X2 (right to the bird) and so on. Everytime the bird moves, they move along and whenever you touch any of them (which could mean getting close to the bird) a trigger activates and it changes the sprite (walking bird to flying bird), speed greatly increases and it just flies away. Then, with a conditional, if bird is at coord. X = last tile of the map, eliminate event.


Maybe this way is complicated but I can't think right now of any better... 😛


Hope it's understandable.
I actually tinkered around with such an effect some time ago. Here is the end result :


unknown-map-birbs.gif




Each bird is a separate event which is moved across the screen using Iavra's Animate Everything plugin. Here is the event-ing behind the effect :

Code:
//
// Bird A (Right)
//

// [Event Tab 1] (Autonomous Movement » Custom)
// • Description : The following is merely to cause the bird to turn at random at a random
//                 interval while perched in the tree.
◆ (Repeat)
::◇Turn at Random
::◇Script:rndTime = Math.floor(Math.random() * (85 - 65 + 1)) + 65; this._waitCount = rndTime;

// [Event Tab 2] (Self-Switch A » Enabled, Trigger » Parallel, Priority » Above Characters)
// • Description : Since Bird B will be startled by the approach of the player and fly away,
//                 I placed a short, random wait before Bird A followed suit. This is done
//                 to make the effect appear more natural.
◆Set Movement Route:This Event (Wait)
:                  :◇Turn Right
◆Script:this.wait(Math.floor(Math.random() * (15 - 5 + 1)) + 5);
◆Script:object = $gameMap.event(17);
:      :mapX = $dataMap.width + 10;
:      :mapY = -5;
:      :var avianTween = new IAVRA.ANIMATE.Tween(object, {_realX : mapX, _realY : mapY}).duration(85);
:      :avianTween.easing(IAVRA.EASING.circ.in);
:      :avianTween.start();
:      :this.wait(95);
◆Control Self Switch:A = OFF
◆Erase Event


//
// Bird B (Left)
//

// [Event Tab 1] (Autonomous Movement » Custom)
// • Description : The following will turn the bird at random and keep track of the location 
//                 of the player. Once the player is within 8 squares, self-switch A of both
//                 birds are triggered and the pair fly away off-screen.
◆ (Repeat)
::◇Turn at Random
::◇Script:var px = $gamePlayer._x; var py = $gamePlayer._y; ($gameMap.event(16)._x.between(px - 8, px + 8) && $gameMap.event(16)._y.between(py - 5, py + 5)) ? ($gameSelfSwitches.setValue([2,16,'A'], true), $gameSelfSwitches.setValue([2,17,'A'], true)) : (rndTime = Math.floor(Math.random() * (45 - 25 + 1)) + 25, this._waitCount = rndTime)

// [Event Tab 2] (Self-Switch A » Enabled, Trigger » Parallel, Priority » Above Characters)
◆Set Movement Route:This Event (Wait)
:                  :◇Turn Right
◆Script:object = $gameMap.event(16);
:      :mapX = $dataMap.width + 10;
:      :mapY = -5;
:      :var avianTween = new IAVRA.ANIMATE.Tween(object, {_realX : mapX, _realY : mapY}).duration(85);
:      :avianTween.easing(IAVRA.EASING.circ.in);
:      :avianTween.start();
:      :this.wait(95);
◆Script:$gameMap.eraseEvent(16);
:      :$gameMap.eraseEvent(17);
◆Control Self Switch:A = OFF

Spoiler

map-bird-a-effect-a.png


map-bird-a-effect-b.png


 
​


map-bird-b-effect-a.png


map-bird-b-effect-b.png
Exhydra nice one! I tried it out just now, using an event sensor plugin and it's the effect I wanted so thanks for that suggestion! Now I might wanna think about random event locations so the birds don't always sit at the same place whenever you enter the map.


Anyone got an idea for the birds flying across the map though? I would love to do it with actual characters instead of pictures and the way the event just disappear at the map's edge when using the "teleport to other side of map when reaching the edge" isn't really smooth.
@Zack Phoenix How about something like the following?

Code:
//
// Bird
//

// [Event Tab 1] (Trigger » Parallel, Priority » Above Characters, Options » Walking, Stepping, Through)
// • Note : Change 'eventId' to the ID of the event.
//          Change 'desiredY' to the Y start point on the screen.
◆If:Script:$gameMap.event(eventId).x > $dataMap.width
  ◆ // If the event is beyond the width of the map ($dataMap.width), reset the position to outside the other side of the screen.
  ◆ //                             setPosition(x, y)
  ◆Script:$gameMap.event(eventId).setPosition(-1, desiredY);
  ◆ // If using Iavra's Animate Everything, use the stop animation command as well.
  ◆
:Else
  ◆ // Start the flying animation; ensure that the animation takes the event beyond the width of the screen to trigger the above.
:End
For comparison, would you mind showing me what it looks like in the actual event?


I am using Animate Everything now and I think I need help with setting up the animation.
Ah, sure thing. Here is what it should come out looking like :


bird-across-screen.gif


 
​


The result is sped up for the sake of capturing a GIF. I would suggest you change the natural pause mentioned below to a higher value.

Spoiler

bird-across-screen-event.png


 
​



◆If:Script:$gameMap.event(3)._realX > $dataMap.width
◆Comment:// Stop avianTween Animation ...
◆Script:$gameVariables.value(5).stop();
◆Comment:// Calculate and Set Random Start Point ...
◆Script:randYSource = (Math.randomInt(19 - 12 + 1)) + 12;
: :$gameMap.event(3).setPosition(-2, randYSource);
◆Comment:// Wait For Natural Pause ...
◆Wait:35 frames
◆
:Else
◆Comment:
◆Script:object = $gameMap.event(3);
: :mapX = $dataMap.width + 10;
: :randYDest = (Math.randomInt(19 - 12 + 1)) + 12;
: :var avianTween = new IAVRA.ANIMATE.Tween(object, {_realX : mapX, _realY : randYDest}).duration(85);
: :$gameVariables.setValue(5, avianTween);
: :$gameVariables.value(5).start();
◆Wait:95 frames
◆
:End



EDIT: Hmm, there is an issue with saved games using this method, though. 


EDIT II: Actually, Animate Everything is making this more difficult than it needs to be. Here is a plugin I just created for 'sliding' events around on the map. Accomplishes the same thing, is simple, and save friendly.


Exhydra - Character Control | Slide To Position


Here is what I put into the event :

Spoiler

bird-across-screen-event-b.png


 
​

Code:
◆Comment:// Calculate and Set Random Start Point ...
◆Script:randYSource = (Math.randomInt(19 - 14 + 1)) + 14;
:      :$gameMap.event(this._eventId).setPosition(-2, randYSource);
◆Comment:// 'Slide' Bird to Random Position ...
◆Script:evX = $dataMap.width + 10;
:      :evY = (Math.randomInt(19 - 14 + 1)) + 14;
:      :$gameMap.event(this._eventId).slideTo(evX, evY, 120);
◆Wait:120 frames
What a good time to check back on this thread.


I tested your plugin just now and it seems to work, which is awesome since I didn't get your previous suggestion to work somehow (birds wouldn't show up). Thanks a lot!


My two questions regarding this method: Is it possible to change the speed of the sliding bird? Changing character speed doesn't seem to change anything. Also, can I use this method to have, say, 3 birds flying across the screen together?
To increase the speed of the birds, decrease the duration set to cross the screen. So, instead of 120 frames, set it to 100 frames or so on (remember to change the wait to reflect the change). Move speed does not factor into the equation. And yes, you can have multiple birds flying across the screen ... everything should work properly.
Thanks, I found the way to increase the amount of frames needed, perfect!


Sorry for not being clear about my second question though - I tested having multiple birds and it works fine but I was talking about a group of birds actually flying together. Is that possible?
Hmm, well, you could edit the bird graphic so that several were flying in a formation. Or you could create a single 'controller' event which will move all three birds at once. Then you could change the beginning and destination of each bird ever so slightly, so that they would appear to be flying in formation.


bird-across-screen-b.gif






If you are going to use the latter option, remember to remove the scripting from the birds and set the trigger for each to 'Action Button'.

Spoiler
bird-across-screen-event-c.png


Code:
◆Comment:// Calculate and Set Random Start Point ...
◆Script:randYSource = (Math.randomInt(19 - 14 + 1)) + 14;
:      :$gameMap.event(3).setPosition(-3, randYSource);
:      :$gameMap.event(4).setPosition(-2, randYSource);
:      :$gameMap.event(5).setPosition(-1, randYSource);
◆Comment:// 'Slide' Bird to Random Position ...
◆Script:evX = $dataMap.width + 10;
:      :evY = (Math.randomInt(19 - 14 + 1)) + 14;
:      :$gameMap.event(3).slideTo(evX, evY + 0.5, 100);
:      :$gameMap.event(4).slideTo(evX, evY - 0.5, 95);
:      :$gameMap.event(5).slideTo(evX, evY + 1.5, 110);
◆Wait:120 frames
This is just perfect Exhydra, I'm sure I'm not the only one who finds this incredibly helpful.


Thanks a lot! You filled my world with a lot more bird poop and everyone is grateful... well maybe not everyone..

IMG_20160816_043518_297.jpg
You're welcome!

Original thread: https://forums.rpgmakerweb.com/threads/birds-flying-across-the-map-how-to-do-it-best.66850/