268 or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
268 or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
269 if not (TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) |
269 if not (TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) |
270 or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
270 or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1; |
271 end; |
271 end; |
272 if not TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX; |
272 if not TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX; |
|
273 SetAllHHToActive; |
273 |
274 |
274 if not HHTestCollisionYwithGear(Gear, 1) then |
275 if not HHTestCollisionYwithGear(Gear, 1) then |
275 begin |
276 begin |
276 Gear.Y:= Gear.Y + 1; |
277 Gear.Y:= Gear.Y + 1; |
277 if not HHTestCollisionYwithGear(Gear, 1) then |
278 if not HHTestCollisionYwithGear(Gear, 1) then |
299 end |
300 end |
300 end |
301 end |
301 end |
302 end |
302 end |
303 end |
303 end |
304 end |
304 end; |
305 end |
305 SetAllHHToActive |
|
306 end |
306 end |
307 end; |
307 end; |
308 |
308 |
309 //////////////////////////////////////////////////////////////////////////////// |
309 //////////////////////////////////////////////////////////////////////////////// |
310 procedure doStepHedgehogFree(Gear: PGear); |
310 procedure doStepHedgehogFree(Gear: PGear); |
311 begin |
311 begin |
|
312 //DeleteCI(Gear); |
312 if not HHTestCollisionYwithGear(Gear, 1) then |
313 if not HHTestCollisionYwithGear(Gear, 1) then |
313 begin |
314 begin |
314 if (Gear.dY < 0) and HHTestCollisionYwithGear(Gear, -1) then Gear.dY:= 0; |
315 if (Gear.dY < 0) and HHTestCollisionYwithGear(Gear, -1) then Gear.dY:= 0; |
315 Gear.State:= Gear.State or gstFalling or gstMoving; |
316 Gear.State:= Gear.State or gstFalling or gstMoving; |
316 Gear.dY:= Gear.dY + cGravity |
317 Gear.dY:= Gear.dY + cGravity |
327 |
328 |
328 if (Gear.State and gstMoving) <> 0 then |
329 if (Gear.State and gstMoving) <> 0 then |
329 if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then |
330 if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then |
330 if ((Gear.State and gstFalling) = 0) then |
331 if ((Gear.State and gstFalling) = 0) then |
331 if abs(Gear.dX) > 0.01 then |
332 if abs(Gear.dX) > 0.01 then |
332 if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.9; Gear.Y:= Gear.Y - 1 end else |
333 if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.90; Gear.Y:= Gear.Y - 1 end else |
333 if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.9; Gear.Y:= Gear.Y - 2 end else |
334 if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.88; Gear.Y:= Gear.Y - 2 end else |
334 if not TestCollisionXwithXYShift(Gear, 0, -3, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.9; Gear.Y:= Gear.Y - 3 end else |
335 if not TestCollisionXwithXYShift(Gear, 0, -3, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.84; Gear.Y:= Gear.Y - 3 end else |
335 if not TestCollisionXwithXYShift(Gear, 0, -4, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.9; Gear.Y:= Gear.Y - 4 end else |
336 if not TestCollisionXwithXYShift(Gear, 0, -4, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.81; Gear.Y:= Gear.Y - 4 end else |
336 if not TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.3; Gear.Y:= Gear.Y - 5 end else |
337 if not TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.78; Gear.Y:= Gear.Y - 5 end else |
337 if abs(Gear.dX) > 0.02 then Gear.dX:= -0.5 * Gear.dX |
338 if abs(Gear.dX) > 0.02 then Gear.dX:= -0.5 * Gear.dX |
338 else begin |
339 else begin |
339 Gear.State:= Gear.State and not gstMoving; |
340 Gear.State:= Gear.State and not gstMoving; |
340 Gear.dX:= 0.0000001 * Sign(Gear.dX) |
341 Gear.dX:= 0.0000001 * Sign(Gear.dX) |
341 end |
342 end |