Making item into projectile fails assert
Posted: Thu Jan 22, 2015 2:37 am
Let's say I have an item that is already on the map and is on the ground (not flying). I want to "throw" the item with a script. Assume e is the item's GameObject.
This appears to work fine at first, making the item into a projectile, but as soon as it collides with something and the game tries to place it on the ground again, this assert fails:
How can I make the item flying?
Code: Select all
local p = e:createComponent("Projectile")
p:setVelocity(8)
p:setFallingVelocity(8)
p:setGravity(4)Code: Select all
[string "Item.lua"]:0: item is not flying
stack traceback:
[C]: in function 'assert'
[string "Item.lua"]: in function 'land'
[string "Item.lua"]: in main chunk
[string "GameObject.lua"]: in function 'sendMessage'
[string "Projectile.lua"]: in function 'update'
[string "Map.lua"]: in function 'updateComponents'
[string "Map.lua"]: in function 'updateEntities'
[string "Dungeon.lua"]: in function 'updateLevels'
[string "GameMode.lua"]: in function 'update'
[string "DungeonEditor.lua"]: in main chunk
...