Erayd
Member
I'm having some strange feedback in my game at the moment. When the player collides with an enemy an event triggers in the player that is the collision event to an enemyBase all enemies are children of. Inside of the code the player health is lowered by the enemy strength. Very simple.
The issue pops up when I add upgrades which raise the player strength. When I change the player strength to 2 or 3, suddenly the player is taking 2 or 3 damage per hit. It does of course also give 2 or 3 damage when the player attacks. So maybe my use of "other" is wrong? I can't find any useful documentation on the use of this event or what other specifically refers to in this event.
My collision to an enemy base event inside of the player:
The enemy has no collision event with the player, just a hitbox event because the player has to be attacking and creating hitboxes in order to hurt enemies. Please let me know if you need to see more of the code. When a player touches an upgrade, an event runs in the upgrade object. If it collides with a player then obj_Player.strength += 1; Then it destroys itself.
Also something a little weird, why wont any show_debug_message() code run inside of that event when its set inside of the invincible section? I can see invincible is obviously being changed and the health subtraction is obviously happens. Makes no sense.
The issue pops up when I add upgrades which raise the player strength. When I change the player strength to 2 or 3, suddenly the player is taking 2 or 3 damage per hit. It does of course also give 2 or 3 damage when the player attacks. So maybe my use of "other" is wrong? I can't find any useful documentation on the use of this event or what other specifically refers to in this event.
My collision to an enemy base event inside of the player:
Code:
if(invincible == 0) {
hp -= other.strength;
invincible = 60;
var oldX = phy_linear_velocity_x;
var oldY = phy_linear_velocity_y;
phy_speed_x = 0;
phy_speed_y = 0;
physics_apply_impulse(phy_position_x, phy_position_y, (phy_position_xprevious - phy_position_x) - oldX, (phy_position_yprevious - phy_position_y) - oldY);
with(other){
phy_speed_x = 0;
phy_speed_y = 0;
}
}
Also something a little weird, why wont any show_debug_message() code run inside of that event when its set inside of the invincible section? I can see invincible is obviously being changed and the health subtraction is obviously happens. Makes no sense.
Last edited: