I have obviously not understood the obtaining of a sprite from an anonymous sprite.
I have...
The 'If' line gives the error that object is not set to an instance of an object.
Previously in this sub I was able to refer directly to the sprite because there was only one. Now I want to add a second, then the collision is caused by an anonymous sprite and I have to find out which, so I understand that I must treat the sprite as 'generic' until I find its ID, then I presume I could use the now known sprite direct.
[EDIT]
But why doesn't my code work?
And why must I declare Spr.New1 locally and not in App_Start (where it gives an error must use New)?
I have...
B4X:
Sub gw_CollisionDestination
Spr.New1
Spr.value=gw.Sprite1
If Spr.ID="cw" Then
Previously in this sub I was able to refer directly to the sprite because there was only one. Now I want to add a second, then the collision is caused by an anonymous sprite and I have to find out which, so I understand that I must treat the sprite as 'generic' until I find its ID, then I presume I could use the now known sprite direct.
[EDIT]
But why doesn't my code work?
And why must I declare Spr.New1 locally and not in App_Start (where it gives an error must use New)?
Last edited: