Discuss Scratch

DinosaurHotdog
New Scratcher
11 posts

Detecting multiple clones at the same time

In my game there is a shotgun that fires 3 bullets at a time, each doing 2.5 dmg.
Each enemy has 3 hp, which means 2 bullets from the gun should already kill it BUT beacuse the enemy can only detect IF a bullet is touching it and not HOW MANY bullets are touching it you can fire a hundred bullets at the same time and it would still only take 2.5 dmg.
any fix?
imFrumpy
Scratcher
43 posts

Detecting multiple clones at the same time

try adding this script to every clone:

whenIstartasacloneforeveriftouchingenemy?thenchangedamageby2.5broadcasttakedamage

then add this to the enemy:

whenIreceivetakedamagechangeHealthbyjoin-damage

if this does not work, please share the project with me! I might be able to help better that way.

Last edited by imFrumpy (Nov. 20, 2022 16:54:38)

DinosaurHotdog
New Scratcher
11 posts

Detecting multiple clones at the same time

imFrumpy wrote:

try adding this script to every clone:

whenIstartasacloneforeveriftouchingenemy?thenchangedamageby2.5broadcasttakedamage

then add this to the enemy:

whenIreceivetakedamagechangeHealthbyjoin-damage

if this does not work, please share the project with me! I might be able to help better that way.





Sadly this would not work, the enemies are clones and a broadcast would affect all of them
https://scratch.mit.edu/projects/763358246/ here is the project, switch to the shotgun
it is also worth mensioning that the project is meant to be run in turbowarp with the settings:
-interpolation on
-warp timer on
-infinite clones on
-remove fencing on
-remove miscellaneous limits on
-everything else off

Last edited by DinosaurHotdog (Nov. 20, 2022 17:04:23)

DinosaurHotdog
New Scratcher
11 posts

Detecting multiple clones at the same time

Eventually I actually got this working, but instead of using variables I used a list.
Basically every time the shotgun shoots it resets the list and every time the bullet touches the enemy it sets the item 1 of the list to list + 2.5 and every time an enemy touches the bullet, it takes the item 1 of the list or the combined damage and subtracts it from it's health

Last edited by DinosaurHotdog (Nov. 25, 2022 21:54:15)

Powered by DjangoBB