Ok, thats it.
First of all, i dont know if its for the last update of the website, but it goes better. Anyway, its still a little slow when balls "spawn" (their x and y change, their image too (ill try to optimitzate the images) and their clock that lasts two seconds is activated and then desactivated)
To put you in some context, as im not english and the names for my variables and the use for the app could confusing, its an app with a firearm that you can move and aim with an objective that you can also move, basically. The photo uphere is a screenshot.
The arrows change the angle of the weapon, in mi idiom "arma", the main block.
The next block is to make the balls bounce, theres one block like it for every ball.
Then, a timer. Every ball has a timer. When its "fired", the clock is activated and after something like 2 seconds the clock makes the ball invisible, sets its speed to 0 and deactivates the clock itself. Theyre named clock1, 2, etc...
The next block its the same but for a diferent type of shot (a buckshot), so it makes the same but for three balls at the same time.
After that, theres the one that makes thatwhen you press the button "tipusdetir" (type of shot) and changes between buckshot and single shot.
The next one is the block of the target. When its collided, it calls the process "hit".
The global below, would traduce to "hits to the target" - you know what it does
After the repited blocks, the "cadenatObert2" sets the lock of the gun off, to make it able to shot
The "municio restant" is used to set the munition that is left once you shot, that sums up once the ball disapeared,and is shown in the upper left part of the canvas. (it uses six more sprites, one for ball, should i change it?)
Dont mind the "desbloquejarArmes"
The angle display is to show what angle is the weapon in at the bottom center button.
moure diana, traduces to move target. you should also know what it does
cadenatTancat does the same as cadenatObert but seting on the block of the weapon so it cant shot
TipusTirGlobal, would traduce to type of shot, and "senzill" to simple. the simple shot is the single one
Aaaand here we go: The arma block
Its a serie of statements, that says if the weapon sould shot, and what (buckshot, single)
First condition: The weapon block is off
Second one: resting amo is more than zero
Third one: The type of shot is single shot. Then:
Checks wich one of the balls should fire, it goes through them to avoid repiting
The rest of the code is understandable in english
If its a buckshot:
Does the same but with three balls at the same time.
I don't have time for more, if you need something else comment it and i will explain whatever
Thanks for all the time and for reading this all xD