File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -200,12 +200,21 @@ WalkingBadguy::collision_solid(const CollisionHit& hit)
200
200
if (m_physic.get_velocity_y () > 0 ) m_physic.set_velocity_y (0 );
201
201
}
202
202
203
- if ( hit.slope_normal .x == 0 .0f &&
204
- ((hit.left && m_dir == Direction::LEFT) ||
205
- (hit.right && m_dir == Direction::RIGHT)) ) {
203
+ if ((hit.left && m_dir == Direction::LEFT) ||
204
+ (hit.right && m_dir == Direction::RIGHT)) {
205
+
206
+ // Enemies get stuck in some tiles #3239 FIX
207
+ // When a bad guy is about to step onto a slope, have it manually step onto it
208
+ if (std::abs (hit.slope_normal .x ) > 0 .0f && std::abs (hit.slope_normal .x ) < 0 .7f ) {
209
+ Vector movement = m_col.get_movement ();
210
+ movement.y -= 5 ;
211
+ m_col.set_movement (movement);
212
+ // setting the movement of the CollisionObject
213
+ } else {
214
+ // If it's anything but a sloped surface, turn around like normal
206
215
turn_around ();
216
+ }
207
217
}
208
-
209
218
}
210
219
211
220
HitResponse
You can’t perform that action at this time.
0 commit comments