Why do my sprites break when they're supposed to regenerate at a different location?

Basically I'm creating a slot machine. I have a one second timer that moves 9 different image sprites. Each image sprite has a true or false tag. Every time it goes off, it's supposed to check whether that exact image sprite is true or false. If it's true, it's supposed to continued moving. If false, it stops, becomes invisible, and teleports to the bottom/top. However when I run the program, entire columns of sprites disappear immediately or slam themselves on edge. What should I do?

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.
export_and_upload_aia

P.S. it's possible to set a Canvas bigger than the Arrangement containing it, and to allow sprites to extend beyond the edges.

Search this board for FAQ Canvas

Roulette_game(1).aia (686.7 KB)
(Update)
I notice a problem with the original greater than/lesser than signs and fixed it. Now columns either won't move or will, but will slam themselves at the bottom. I also changed the methods of teleporting the opposite end to Set Y instead of MoveTo Y.

I read your code, and you have a problem with the variable 'sprite'.

You use it alternately as

  • a true/false enabled value
  • a component selected from your table Sprites
  • a procedure parameter.

I would rip out your sprite movement logic,
reduce the number of sprites to 3 (one per column),
turn off those rotates flags on the sprites to allow the sprites to move under their own power,
only let one sprite move at a time behind the proscenium, swapping out its picture randomly when it hits an edge and relocating it to the opposite edge,
stop the currently moving sprite at timer time, and line it up, before starting the next sprite moving.

After three timer cycles, when 3 sprites have stopped, check if their pictures match. If all match, assign points by lookup in a dictionary of image file names and points.

Roulette_game(2).aia (684.4 KB)
(Update)
I made a different parameter for the enabled check and now it only moves one before breaking. I would prefer to keep all 9 if possible, but I turned off rotation. Do you have like a visual or screenshot for the movement logic you were talking about?



Roulette_game_ABG.aia (677.2 KB)
sample run

Here's a rework using your art work.
Making the bottom wall shorter will give the moving sprites more screen time, for better effect.

I left out score accumulation.

Okay! Thank you so much! I tweak your code a bit and added some new features, but the main issues of the sprites is fixed!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.