For this week in 2D, I kept on working on my AI butterfly, change some setting for my old particles.
1. Apple falling: enable physic through trigger box.
I am trying to figure out how to make 2 blue print communicate. I have a pickable apple blueprint and a trigger box blueprint.
I created a interface blueprint with one function called toggle on/off.
Inside trigger box blueprint I called toggle on/off function from interactive blueprint. When player enter the trigger volume, it called my toggle on/off function and set the return value to true.
Then inside apple blueprint I make the toggle on/off as my begin event. When the toggle event is true, it will turn simulate physic on my apples inside apple blueprint
2.AI_Butterfly continue from last week
Before butterfly take off again, I have the retriggerable delay function in between so that the butterfly would take a rest before it take off again. The duration of the retriggerable delay function is link to a random range which is link to an integer variable that represent its time in flight.
For take off and flying back sequence, I take the landing begin position and set it as my new location and activated the particle trail, play the flight animation and stop the resting animation, reset my time in flight to 0 and reset my upward/forward speed, then delay about 2 second.
Then I enable the collision again, zero out the upward speed, increase the forward speed, increase play rate for flight animation so that it will fly faster farword.