Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 35 | chris | 1 | unit app_entity_impact; |
| 2 | |||
| 3 | interface |
||
| 4 | |||
| 5 | uses sux_constant, sux_object, app_constant, app_entity_main, |
||
| 6 | app_game_player; |
||
| 7 | |||
| 8 | type |
||
| 9 | TImpact=record |
||
| 10 | inverse: SXBool; |
||
| 11 | mode:SXState; |
||
| 12 | end; |
||
| 13 | SAEImpact=class(SAEntity) |
||
| 14 | impact:TImpact; |
||
| 15 | |||
| 16 | procedure setInverseMovement(inverse: SXBool); |
||
| 17 | procedure setMode(mode:SXState); |
||
| 18 | |||
| 19 | procedure onTimer; override; |
||
| 20 | |||
| 21 | procedure initialize; override; |
||
| 22 | constructor Create(parent:TObject); |
||
| 23 | destructor Destroy; override; |
||
| 24 | end; |
||
| 25 | |||
| 26 | implementation |
||
| 27 | |||
| 28 | uses main; |
||
| 29 | |||
| 30 | |||
| 31 | // --- SAEImpact |
||
| 32 | |||
| 33 | |||
| 34 | procedure SAEImpact.setInverseMovement(inverse: SXBool); |
||
| 35 | begin |
||
| 36 | impact.inverse := inverse; |
||
| 37 | end; |
||
| 38 | |||
| 39 | |||
| 40 | procedure SAEImpact.setMode(mode:SXState); |
||
| 41 | begin |
||
| 42 | impact.mode:=mode; |
||
| 43 | |||
| 44 | case mode of |
||
| 45 | SX_EIMPACT_MODE_WALL : setupAppearance(app.scene.board.settings.wallimpact,30); |
||
| 46 | SX_EIMPACT_MODE_PADDLE : setupAppearance(app.scene.board.settings.paddleimpact,40); |
||
| 47 | end; |
||
| 48 | end; |
||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | procedure SAEImpact.onTimer; |
||
| 54 | begin |
||
| 55 | if (impact.mode=SX_EIMPACT_MODE_PADDLE) then |
||
| 56 | begin |
||
| 57 | if ((settings.rot=0) and (not impact.inverse)) |
||
| 58 | or ((settings.rot=180) and (impact.inverse)) then sx.timer.incTimer(settings.pos.x,10) |
||
| 59 | else sx.timer.incTimer(settings.pos.x,-10); |
||
| 60 | end; |
||
| 61 | |||
| 62 | sx.timer.decTimer(settings.density,3); |
||
| 63 | sx.timer.incTimer(settings.size,20); |
||
| 64 | if (settings.density<=0) then delete; |
||
| 65 | end; |
||
| 66 | |||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | procedure SAEImpact.initialize; |
||
| 71 | begin |
||
| 72 | end; |
||
| 73 | |||
| 74 | |||
| 75 | constructor SAEImpact.Create(parent:TObject); |
||
| 76 | begin |
||
| 77 | inherited Create(parent); |
||
| 78 | |||
| 79 | setupAppearance(app.scene.board.settings.wallimpact,30); |
||
| 80 | setBlending(SX_GL_BLEND_AVERAGE,1); |
||
| 81 | |||
| 82 | setMode(SX_EIMPACT_MODE_WALL); |
||
| 83 | impact.inverse := false; |
||
| 84 | end; |
||
| 85 | |||
| 86 | |||
| 87 | destructor SAEImpact.Destroy; |
||
| 88 | begin |
||
| 89 | inherited; |
||
| 90 | end; |
||
| 91 | |||
| 92 | |||
| 93 | end. |