| 359 | |
| 360 | == Pawn == |
| 361 | If an object in your level should have health and be killable you need the Pawn class. Pawns can have a weapon system, can have a shield and if you shoot at them they'll die if their health is reduced to zero. |
| 362 | {{{ |
| 363 | #!xml |
| 364 | <Pawn team=1 health=30 shieldhealth=130 initialshieldhealth=130 maxshieldhealth=150 shieldabsorption=0.95 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box> |
| 365 | <attached> |
| 366 | <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> |
| 367 | </attached> |
| 368 | <collisionShapes> |
| 369 | <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" /> |
| 370 | </collisionShapes> |
| 371 | </Pawn> |
| 372 | }}} |
| 373 | Pawn interits from ControllableEntity. |
637 | | <Backlight position="0,0,0" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,1,0.05"/> |
638 | | <DistanceTrigger name="flying1" position="0,0,0" target="Pawn" distance=10 stayActive="true" delay=2/> |
639 | | |
640 | | <SimpleNotification message="Let's fly to the blinking light." broadcast="true"> |
| 652 | <Backlight position="0,0,0" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,0"/> |
| 653 | <SimpleNotification message="Red Backlight." broadcast="true"> |
| 654 | <events> |
| 655 | <trigger> |
| 656 | <DistanceTrigger position="0,0,0" target="ControllableEntity" distance=25 stayActive="true"/> |
| 657 | </trigger> |
| 658 | </events> |
| 659 | </SimpleNotification> |
| 660 | }}} |
| 661 | '''DistanceTriggers''' are activated, when the target (e.g. a pawn, a spaceship, ...) is close enough to the distance trigger (defined via "'''distance'''"). The '''stayActive''' attribute keeps the switch activated once triggered - the event can only be created once. |
| 662 | In the next example the DistanceTrigger ist no more placed inside the SimpleNotification. Instead it ist placed outside and a EventListerner is placed inside. |
| 663 | {{{ |
| 664 | #!xml |
| 665 | <Backlight position="0,200,0" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="0,0,1"/> |
| 666 | <DistanceTrigger name="flying1" position="0,200,0" target="Pawn" distance=10 stayActive="true" delay=2/> |
| 667 | <SimpleNotification message="Blue Backlight." broadcast="true"> |
648 | | '''DistanceTriggers''' are activated, when the target (e.g. a pawn, a spaceship, ...) is close enough to the distance trigger (defined via "'''distance'''"). The '''stayActive''' attribute keeps the switch activated once triggered - the event can only be created once. The name '''flying1''' is needed in order to catch the event, when the trigger was activated. The '''SimpleNotification''' is sent to the player when the trigger is activated. Note that the trigger is activated with a delay of 2 seconds. |
| 675 | The name '''flying1''' is needed in order to catch the event, when the trigger was activated. The '''SimpleNotification''' is sent to the player when the trigger is activated. Note that the trigger is activated with a delay of 2 seconds. |
| 676 | The EventListener provides an 1:n mapping between one listener and multiple event-sources. In the next example any of the two event listeners will show the simple notification: |
| 677 | {{{ |
| 678 | #!xml |
| 679 | <Backlight position="0,400,100" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="0,1,0"/> |
| 680 | <Backlight position="0,400,-100" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="0,1,0"/> |
| 681 | <DistanceTrigger name="flying2" position="0,400,-100" distance=25 target="ControllableEntity" /> |
| 682 | <DistanceTrigger name="flying2" position="0,400,100" distance=25 target="ControllableEntity" /> |
| 683 | <SimpleNotification message="Green Backlight." broadcast="true"> |
| 684 | <events> |
| 685 | <trigger> |
| 686 | <EventListener event="flying2" /> |
| 687 | </trigger> |
| 688 | </events> |
| 689 | </SimpleNotification> |
| 690 | }}} |