Changeset 11936 for code/branches
- Timestamp:
- May 3, 2018, 4:01:23 PM (7 years ago)
- Location:
- code/branches/ScriptableController_FS18
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw
r11928 r11936 1 1 <LevelInfo 2 2 name = "AAAScriptableControllerTest" 3 description = " A level with absolutely nothing in it."3 description = "Demonstrates moving and killing a drone by use of a script." 4 4 tags = "test" 5 5 screenshot = "emptylevel.png" … … 30 30 31 31 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/> 32 <SpawnPoint team=0 position=" -200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />32 <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort /> 33 33 34 34 35 <ModularSpaceShip id="Station" velocity= "0,0,0" position="50000000,0,0" lookat= "0,0,0" health="500" maxhealth="500" initialhealth="500"> 36 <templates> 37 <Template link=endurance /> 38 </templates> 39 </ModularSpaceShip> 35 <AAAAutonomousDrone id="dummy" position="0,0,0"> 36 <attached> 37 <Model scale="10" mesh="drone.mesh"/> 38 </attached> 39 <collisionShapes> 40 <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" /> 41 </collisionShapes> 42 </AAAAutonomousDrone> 40 43 44 45 46 41 47 </Scene> 42 48 </Level> -
code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua
r11928 r11936 1 1 2 rotate_factor = 0 3 station_loc = 200 4 station_speed = 0 2 rotate_factor = 0.0 3 station_loc = 200.0 4 station_speed = 0.0 5 6 id = "dummy" 7 5 8 6 9 function spawn_station(obj) … … 9 12 setOrientation("Station", 0, -1, 0, 0) 10 13 end 14 11 15 12 16 function rotate_faster(obj1, obj2, health, shield) … … 23 27 end 24 28 29 25 30 function kill_player_after_timeout(pawn) 26 31 orxPrint("Killing player after 5s") … … 28 33 registerAfterTimeout(kill_player, 5) 29 34 end 35 30 36 31 37 function next_station_loc(obj1, obj2) … … 42 48 43 49 50 function kill_player() 51 orxPrint("Killing player") 52 killPawn("Player") 53 end 44 54 55 56 function kill_dummy() 57 orxPrint("Killing dummy!") 58 killPawn(id) 59 end 60 61 62 function kill_player_after_timeout(pawn) 63 orxPrint("Killing player after 5s") 64 65 registerAfterTimeout(kill_player, 5) 66 end 67 68 69 function kill_dummy_after_timeout(seconds) 70 orxPrint("Killing dummy after " .. tostring(seconds)) 71 registerAfterTimeout(kill_dummy, seconds) 72 end 73 74 75 function move_dummy() 76 orxPrint("Moving dummy!") 77 moveControllableEntity(id, 1.0, 0.0, 0.0) 78 end 79 80 81 function move_dummy_after_timeout(seconds) 82 orxPrint("Moving dummy after " .. tostring(seconds)) 83 84 registerAfterTimeout(move_dummy, seconds) 85 end 86 87 88 89 90 move_dummy_after_timeout(5) 91 kill_dummy_after_timeout(10) 45 92 46 93 47 94 orxPrint("Script started! OMG ROFL LOL WTF") 48 95 mytestfunction(3.0, 4.0) 49 spawn("ModularSpaceShip","Station2")50 96 97 98 spawn("ModularSpaceShip", "sepp") 99 setPosition("sepp", 500, 0, 0) -
code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua
r11932 r11936 1 1 2 2 id = "dummy" 3 4 3 5 4 … … 22 21 end 23 22 23 24 24 function kill_dummy_after_timeout(seconds) 25 25 orxPrint("Killing dummy after " .. tostring(seconds)) … … 33 33 end 34 34 35 35 36 function move_dummy_after_timeout(seconds) 36 37 orxPrint("Moving dummy after " .. tostring(seconds)) 37 38 38 registerAfterTimeout(move_dummy, seconds) 39 39 end -
code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
r11932 r11936 394 394 if(entity == nullptr) 395 395 { 396 orxout(user_warning) << "Trying to set velocity ofan unknown object" << std::endl;396 orxout(user_warning) << "Trying to move an unknown object" << std::endl; 397 397 return; 398 398 } … … 407 407 { 408 408 controllable_entity = orxonox_cast<ControllableEntity*>(entity); 409 409 //ATTACHED COLLISION SHAPE is MANDATORY in order to move the entity 410 410 controllable_entity->moveFrontBack(x); 411 411 controllable_entity->moveRightLeft(y);
Note: See TracChangeset
for help on using the changeset viewer.