Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/data/levels/scripts/ScriptableControllerSpawn.lua

Last change on this file was 12006, checked in by adamc, 6 years ago

first final draft

File size: 1.9 KB
Line 
1
2rotate_factor = 0.0
3station_loc = 200.0
4station_speed = 0.0
5
6id = "dummy"
7
8
9function spawn_station(obj)
10        orxPrint("Spawning station")
11        setPosition("Station", 500, 0, 0)
12        setOrientation("Station", 0, -1, 0, 0)
13end
14
15
16function rotate_faster(obj1, obj2, health, shield)
17        orxPrint("Rotating station faster")
18
19        rotate_factor = rotate_factor + 0.02
20        setAngularVelocity("Station", rotate_factor, 0, 0)
21end
22
23
24function kill_player()
25        orxPrint("Killing player")
26        killPawn("Player")
27end
28
29
30function kill_player_after_timeout(pawn)
31        orxPrint("Killing player after 5s")
32
33        registerAfterTimeout(kill_player, 5)
34end
35
36
37function next_station_loc(obj1, obj2)
38        orxPrint("Moving station")
39
40        station_loc = station_loc + 500
41        setPosition("Station", station_loc, 0, 0)
42
43        station_speed = station_speed + 5
44        setVelocity("Station", -station_speed, 0, 0)
45
46        registerAtNearObject(next_station_loc, "Player", "Station", 200)
47end
48
49
50function kill_player()
51        orxPrint("Killing player")
52        killPawn("Player")
53end
54
55
56function kill_dummy()
57        orxPrint("Killing dummy!")
58        killPawn(id)
59end
60
61
62function spawn_dummy()
63        orxPrint("Spawning dummy!")
64        spawnTest("dummy")
65        move_dummy()
66end
67
68
69function kill_player_after_timeout(pawn)
70        orxPrint("Killing player after 5s")
71
72        registerAfterTimeout(kill_player, 5)
73end
74
75
76function kill_dummy_after_timeout(seconds)
77        orxPrint("Killing dummy after " .. tostring(seconds))
78        registerAfterTimeout(kill_dummy, seconds)
79end
80
81
82function move_dummy()
83        orxPrint("Moving dummy!")
84        moveControllableEntity(id, 1.0, 0.0, 0.0)
85end
86
87
88function move_dummy_after_timeout(seconds)
89        orxPrint("Moving dummy after " .. tostring(seconds))
90
91        registerAfterTimeout(move_dummy, seconds)
92end
93
94
95function spawn_dummy_after_timeout(seconds)
96        orxPrint("Spawning dummy after " .. tostring(seconds))
97        registerAfterTimeout(spawn_dummy, seconds)
98end
99
100
101
102
103orxPrint("Script started! OMG ROFL LOL WTF")
104mytestfunction(3.0, 4.0)
105
106
107spawn_dummy_after_timeout(5)
108
109
110
Note: See TracBrowser for help on using the repository browser.