Four Sprites unreliable from List

Initialization of app fails cause, I think, a Sprite Component list item number is 0, rather than 1 -> 4. Repeating this again using Do It works fine. I think it also has to do with the Sprite X Canvas field. The 4 Sprites are loaded to a Canvas, within a HA. What should I do? Thanks Charles :smiley:

Your component list will be indexed from 1 -4

I can't see how this will work for sprites 2,3 and 4 ?
Do you want them all the same size and in the same place on the canvas?

Suggest use a for each item loop

You're right! These other three procedures are the same as Sprite1. They are the same use the list. As you may guess, they all fail on the first initialization. I was just saving on Forum's space. :blush:

  1. No they are not the same size. The X items are each a different size and initialize them across the Canvas.
  2. The first time I tried this was with a for loop and a 4 sprite list, without the Xs. The X sprites were done separately.
  3. I then tried it the way I showed you originally for Sprite1.
  4. How can I make this one sprite work correctly, no list?
    Thanks, Charles :unamused:

Try something like this:

canvas is set to fill parent in width and height, so you need to give some time with a clock for the canvas to get its dimensions. You can improve automation/dynamism by using more lists for your positions and sizes.

Very elegant! I changed to a 'Send List Item' for the sprites which works great for my initialization of the four Sprites. Thanks Charles :grin:

TimAI2, Continuing with my Script app the 'Dragged' function causes an error. Label-1&2 give a correct result, but Label 3 indicates 7 items in the list rater than 8, the correct answer (8 items). Am I using the Component button incorrectly? Why? Thanks Charles :unamused:

Could you please show what your "NewNumProc" and "GetSpriteDetail" procedures are doing

TimAI2, Here are the 2 attachments you asked for. Charles :eyes:

Sorry! See attachment for correct "GetSpriteDetail". Thanks again Charles :cry:

This one appears to "go down the rabbit hole" for me. Perhaps someone else can untangle it?

Why are you using TinyDB for Sprite data?

I have four sprites, each using attached data, who interact with each other. 'Each sprite gets it's info with 'GetSpriteDetail', uses the data and then saves it with 'SaveSpriteDetail'.
Thanks, Charles :eyes:

If you use the Any Sprite Dragged event, you have to take care to distinguish between which Sprites you want that event to handle and which Sprites you don't want that event to handle.

There are three ways to do this:

  • set a global variable to catch the TouchDown event of where the drag started, and save the Sprite component for help avoiding Sprite Cannibalism when other Sprites are blundered into by accident.
  • Keep lists of Sprites by function (Bird Sprites, Bullet Sprites, background Sprites) and check Is In List for the dragged component to decide how to handle that component.
  • Use the if notHandled variable of the event to test if other event blocks should be handling this event for this Sprite, and not this general purpose event.


ABG - Thank you for your input about "Distinguishing between Sprites". I'll check it out.
TimAI2 - Initiating these four sprites take two tries. I get a Runtime Error (it's looking for a Number?). After when I Dismiss the error and try it again, it works!
If you check the InitialClock proc you'll see I access the sprite first with a list and the second with Sprite2. What am I missing?

Thanks, Charles


Your error message says you are trying to select item 0 of a list of 4 Button components.

Buttons are not Sprites.

Look elsewhere.

Also, if you are going to select items from a list in a Clock Timer,
don't let that Clock run before you have loaded up that list with items.

  1. That really is confusing; certainly Buttons are not Sprites! My list is of Sprites, with each having 9, or sub-lists. I see this as a three step process. 1. A list variable makes a list with 4 sprites. 2. I initialize 4 sprites with 9 items, and then 3. I initialize the ImageSprite. What more must I do I do to "load up that list with items"? Thanks Charles :stuck_out_tongue_winking_eye:
    nb: Sorry about the Global, I'm in checkout.

This sample is too small for diagnosis.

Export your .aia file and upload it here.

ABG - Sorry, I'm afraid I'm not clever enough to work out your aia example. Sending an aia from my app would cause you too much time and effort to pursue.

The 4 Score buttons are used to score each sprite and initialize (on and off) for battle. Buttons are used to change score upon collision, initialize background color of Score Buttons, and I regular (not any) click buttons for score/sprite control. Hope this helps? Thanks, Charles :sunglasses:


You use global BirdNum two different ways:

  • as an index number
  • as a button component?

Make up your mind.