-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStoneStructure.java
More file actions
47 lines (39 loc) · 1.14 KB
/
StoneStructure.java
File metadata and controls
47 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.angrybirds;
import com.badlogic.gdx.physics.box2d.World;
public class StoneStructure extends Structure {
public StoneStructure(
World world,
float x,
float y,
float width,
float height,
boolean isDynamic
) {
super(
world,
x,
y,
width,
height,
isDynamic,
"stonelongblock.png", // Normal texture
"damagedstonblock.png", // Damaged texture
100f // Health
);
this.density = 13f;
this.friction = 50f;
this.restitution = 0f;
this.linearDamping = 0.1f; // Less linear damping
this.angularDamping = 0.2f; // Less angular damping
updateBodyProperties();
}
public void takeDamage(float damage) {
currentHealth -= damage;
if (currentHealth <= maxHealth * 0.6f && currentHealth>0) {
normalTexture = damagedTexture;
}
else if (currentHealth <= 0) {
this.markedForRemoval = true;
}
}
}