Posted May 07, 2024 by Slyddar
There was an option to allow collisions between the player and an enemy, where the player will take damage. I've disabled it by default, as getting damaged each time you touch an enemy makes the game very hard. It has been disabled for so long, that after I did some other updates it made that line not applicable anymore. So I've made some changes and enabling it now works correctly. The collision event was originally in the player object, but I've now moved it to the o_enemy_parent object. If you are not needing to upgrade versions, but want to know what the changes were, they are listed below :
Delete the o_player <> o_enemy_parent collision event from o_player.
Create a collision event in o_enemy_parent with o_player with this code :
/*
I've removed damage from touching enemies as it allows for better flowing gameplay
The collision for the enemy is set by the enemies collision mask,
so you can make that smaller by changing it on the enemy sprite, but that
also means hitting the enemy with your sword will be harder as there is a
smaller mask. You can uncomment the line below if you want to try it
*/
if hp > 0 {
process_enemy_attack(knockback_wpn_dis, other.knockback_block_dis, true);
}
Lastly edit the process_enemy_attack function and modify this line
//ensure enemy faces player
if variable_instance_exists(other, "owner_id") {
if instance_exists(other.owner_id) other.owner_id.facing = -facing;
}