Crowd control

How do I consistently apply all of these conditions to all sprites of the same?

Everytime only the latest sprites(I think) of that name abide by the conditions and the others don’t change at all.

2 Likes

any breakthroughs?

2 Likes

I dont quite understand your question but here is my best general explanation:

-When you assign a variable to a sprite, it becomes that sprite. Assigning the same variable to another sprite makes the variable now only be the latest sprite. To fix this, use sprite kinds to tell apart multiple sprites of the same kind and apply logic to them.

how do I make all of a sprite kind follow a sprite

1 Like

Use “for element value of list” in the loops category, replace “list” with “array of sprites of kind player” block in the sprites tab, inside the loop add “myenemy follow mysprite”, replace “myenemy” with the drag-able “value” from the loop.

Heres some example code:

(In this case it also randomises the sprites position)

Heres an example project:

You can also use the “on sprite of kind player overlaps othersprite of kind enemy” block in the sprites tab like the project above does to figure out thing like bullets destroying sprites.

1 Like

thank you, also how do I track the distance between the player and all sprites of one kind

2 Likes

You can use the sprite utils extension! It has everything you need to work with multiple sprites of the same kind. not only that it has a block that asks the distance between the 2. https://github.com/jwunderl/arcade-sprite-util if you need more help on this help just ask me, I struggled at first but then I got help with a similar issue.

1 Like

how do I make this work

1 Like

Use for element value of list, replacing list with the “get all sprites of kind spearman within 50 pixels from mysprite” block. Kinda like this:

Example project:

In this project, enemies only follow you when you come near.

thank you

there’s something wrong with my code but the debug won’t work

1 Like

Its this.

Here you try to read the variable “magemen” (assigned to a sprite) as a statusbar, wich does not work.

what does this mean

image

Every time I fix one problem another one shows up from nowhere

You can also use the element value loop along with my sprite basics extension (it has a proximity block)

The problem is the image is messed up; it shouldn’t be this (…) block.
image
To fix this go to the images tab under advanced and find this block:
image
And drag it into the gray (…) block.

1 Like