Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Presentation_HS17/data/levels/scripts/scriptableControllerTest.lua @ 11686

Last change on this file since 11686 was 11684, checked in by kohlia, 7 years ago

Added test level/script

File size: 1.2 KB
Line 
1
2rotate_factor = 0
3station_loc = 200
4station_speed = 0
5
6function spawn_station(obj)
7        orxPrint("Spawning station")
8        setPosition("Station", 500, 0, 0)
9        setOrientation("Station", 0, -1, 0, 0)
10end
11
12function 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)
17end
18
19
20function kill_player()
21        orxPrint("Killing player")
22        killPawn("Player")
23end
24
25function kill_player_after_timeout(pawn)
26        orxPrint("Killing player after 5s")
27
28        registerAfterTimeout(kill_player, 5)
29end
30
31function 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)
41end
42
43orxPrint("Script started!")
44
45registerAtAreaLeave(spawn_station, "Player", -300, -100, -100, 200, 200, 200)
46registerAtPawnHit(rotate_faster, "Station")
47registerAtPawnKilled(kill_player_after_timeout, "Station")
48registerAtNearObject(next_station_loc, "Player", "Station", 200)
49
50setAngularVelocity("Station", 0, 0, 0)
51
Note: See TracBrowser for help on using the repository browser.