Page 1 of 1

Making item into projectile fails assert

Posted: Thu Jan 22, 2015 2:37 am
by minmay
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.

Code: Select all

local p = e:createComponent("Projectile")
p:setVelocity(8)
p:setFallingVelocity(8)
p:setGravity(4)
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:

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
        ...
How can I make the item flying?

Re: Making item into projectile fails assert

Posted: Thu Jan 22, 2015 5:41 pm
by petri
Bug confirmed. Unfortunately I can't think of a workaround for this problem. I've added this to the top of my todo list for the next version.

Thank you for the bug report!