Hi guys,
I would very much appreciate your help.
I am building a game in main.lua where objects are spawned on left screen side and are moving to the
right screen size (Landscape mode).
After object passes Right screen side + 100 they are removed from memory via removeSelf() and nil method.
My problem are as follows:
- Every other spawned object is colliding differently with the ground.
I assume that every other object is colliding differently because first one is destroyed (removeSelf), so
group anchors are calculated based on number of objects on screen (number of object in player group).
I have tried different things:
- moving players into one group, and all other objects into another group, and all objects together into
same screenGroup
- moving main.lua to composer, and using self.view as main group and players as separate group (inserted
in self.view group).
- using default anchorX, anchorY for players
display.setDefault( “anchorX”, 0 )
display.setDefault( “anchorY”, 0 )
Nothing helps,
How to solve this (how to maintain players group anchor X and anchorY same for each spawned object)?
- Another problem.
I have inserted players Runtime and players touch listeners into playerspawn function
due to spawn function scope.
That is not causing errors during scenes transitions.
Can you explain this?
Should I remove players Runtime and players touch listeners during exit and destroy scene?
Many thanks for your help.
Ivan
