We select Cast to 2DSide scroller Character and we also connect the object to the Other Actor node. Then, first we drag from the exec node of our event and search for our character. We want to instruct our enemy to withdraw certain amount of health every time that overlaps our character. This will send you straight ahead to your Event graph. There select "On Component Begin Overlap” Open the enemy blueprint and with the flipbook selected in your components scroll your details panel until you can see the green tabs for the events. Finally open your flipbook double click on it and make sure the collision there is also set to Each frame CollisionĪll set.The collision in the details panel of our spider is set to OverlapAll (scroll down if you don’t see it in the panel).Our enemy is in the value 0 in the location Y axis.First thing is first, we are going to make sure all our collision is set as it should because it is one of the most common mistakes that we can overlook: Now we need to tell our enemy how much damage to cause every time they overlap each other.
We will use this system every time that we want something in the game to cause damage to our character. In the details panel of your variable health, make sure the default value is 1.0 Connect the out node to the Set Health node and the Damage to the remaining node. Form the health variable Get drag and type Float-Float. Now drag again the health and this time choose get. It makes sense? Ok, drag your variable Health to the graph and select the option set health Connect this to the Event. Our health minus the damage will set the new health. Now we will apply simple maths to this event. This is the way your event should look now. Call it Damage and make sure it is a Float type In the details panel of this custom event Add a new input pressing the + symbol.