1 | |
---|
2 | rotate_factor = 0 |
---|
3 | station_loc = 200 |
---|
4 | station_speed = 0 |
---|
5 | |
---|
6 | function spawn_station(obj) |
---|
7 | orxPrint("Spawning station") |
---|
8 | setPosition("Station", 500, 0, 0) |
---|
9 | setOrientation("Station", 0, -1, 0, 0) |
---|
10 | end |
---|
11 | |
---|
12 | function rotate_faster(obj1, obj2, health, shield) |
---|
13 | orxPrint("Rotating station faster") |
---|
14 | |
---|
15 | rotate_factor = rotate_factor + 0.02 |
---|
16 | setAngularVelocity("Station", rotate_factor, 0, 0) |
---|
17 | end |
---|
18 | |
---|
19 | |
---|
20 | function kill_player() |
---|
21 | orxPrint("Killing player") |
---|
22 | killPawn("Player") |
---|
23 | end |
---|
24 | |
---|
25 | function kill_player_after_timeout(pawn) |
---|
26 | orxPrint("Killing player after 5s") |
---|
27 | |
---|
28 | registerAfterTimeout(kill_player, 5) |
---|
29 | end |
---|
30 | |
---|
31 | function next_station_loc(obj1, obj2) |
---|
32 | orxPrint("Moving station") |
---|
33 | |
---|
34 | station_loc = station_loc + 500 |
---|
35 | setPosition("Station", station_loc, 0, 0) |
---|
36 | |
---|
37 | station_speed = station_speed + 5 |
---|
38 | setVelocity("Station", -station_speed, 0, 0) |
---|
39 | |
---|
40 | registerAtNearObject(next_station_loc, "Player", "Station", 200) |
---|
41 | end |
---|
42 | |
---|
43 | orxPrint("Script started!") |
---|
44 | |
---|
45 | registerAtAreaLeave(spawn_station, "Player", -300, -100, -100, 200, 200, 200) |
---|
46 | registerAtPawnHit(rotate_faster, "Station") |
---|
47 | registerAtPawnKilled(kill_player_after_timeout, "Station") |
---|
48 | registerAtNearObject(next_station_loc, "Player", "Station", 200) |
---|
49 | |
---|
50 | setAngularVelocity("Station", 0, 0, 0) |
---|
51 | |
---|