S
SirLagsalott
Guest
I'm currently programming a physics-based game in GameMaker Studio (I'm using the Early Access 1.99.525). I have a "wood" object that is destructible, by the player and by hitting other objects with force. However, the current force-detection method is flawed.
This is the code in the collision event for another instance of wood. Let's say X is the wood executing this code, and Y is the object hitting X. It calculates both their speeds at that moment and applies damage to each of them. The issue is that it is using X's speed to calculate how much damage will be dealt, instead of taking Y's speed and applying damage accordingly. How do I use code to call the properties of the object that just hit it?
Code:
if abs(phy_linear_velocity_x) + abs(phy_linear_velocity_y) > 50 then {
woodhealth = woodhealth - ((abs(phy_linear_velocity_x) + abs(phy_linear_velocity_y))/32)
}