Game Development Reference
In-Depth Information
The Process Chopping function/event will be divided into two main parts. The first part
is responsible for generating random and rotation positions to add the two new parts of the
fruit based on the fruit's current position. The other part is responsible for adding the new
sprites and destroying the full fruit sprite. Force the blueprint to stop receiving new inputs,
so that we can hit a fruit once.
Using Get Relative Location to PaperSprite of the fruit, you can get its location. Then,
using the returned data, you can generate new positions or rotations to the newly chopped
sprites that you'll add. Make sure to use the Random Float in Range , Make Rot , Vect-
or+Vector , and Make Transform nodes to construct randomization logic in your own
style.
I forced the chopped pieces to be in almost the same positions (10 units to the left and
right of the old sprite) and gave them a random rotation between 100 and -100 .
The last part of the fruit blueprint is adding and destroying the newly chopped parts.
Using the node Add PaperSpriteComponent , you can add a new sprite. So using it twice
will cause you to add two new sprites. Don't forget to set each of them to one of the two
Search WWH ::




Custom Search