Help Spawning things lel

Sooooooooooooooooo. I have a problem again… But bear with me,
I have spawner code that works nicely it’s supposed to randomize the animation.
But once I have more than one spawner, the ones that I placed after the first one only spawn the dustZombie!

It looks fine. You say you’re using multiple spawner are they identical? Can you post a screenshot of them?


Tips: You could use timers instead of wait or the spawn behavior.

You could use **tween has finished ** instead of wait.

You could reduce the number of events by putting the zombie information into an array of structures. Then if you assigned the random number to a variable you could set the values using the variable. If you have multiple scenes then you could use a global variable.

Something like

Create an array named zombies
Once you create the first element you can copy and paste it.

Set r to random in range 0,3
Set Damage to zombies[r].Damage
Set max speed to zombies[r].MaxSpeed
(and so on for as many settings you want)

You can use the animation # directly
Set damage to zombies[object name animation number].Damge

But for setting it up, the variable name. Is cleaner looking and easier to explain.

Using a setting in zombie, you can minimize identitical events. Anytime you repeat the same events there’s usually a way to reduce things by either using a variable, a loop like repeat of **for each object **, a variable or an extension.

1 Like

Busy rn will reply tomorrow thx in advance

1 Like

Hey, out of curiosity why did you keep speed a string variable instead of a number one? What’s the benefit of doing it that wayo? I am very new to using variables for anything besides like switching weapons for one unit.

Sorry, that was just a quick example. I would use a number for numbers not a string. They’re probably not that much diffence in the way they’re stored. It’s more the way they’re handled.

adding the numbers 11+22 would be 33
While adding “11” + “22” would be “1122”

(I replaced the image in my other post. Just to avoid any confusion)

1 Like

Okay, sounds good. I have just seen your answers in other posts and know you’re really knowledgeable. Trying to soak up everything that I can. That’s pretty cool of you to go back and adjust the images, I know for learners like me that really helps because there are plenty of times I am copying something to implement in my stuff and then I modify one aspect at a time until I understand what things do.

You’re welcome.

I know the language fairly well. I’m still learning concepts.

@Keith_1357 There isn’t much to screen shot so I’ll just explain. I just dragged out 2 spawner objects and that’s it lol.

Also, it doesn’t work. :frowning_face:
I’m probably overlooking something


I don’t understand what you mean by this. I would like more clarification.

Though I enjoy your method a lot more so hopefully it can work…

Here’s an example of using a timer and the animation number with the structure.

Try me: There is no interaction. It just spawns random zombies. I attached a text object just to demonstrate the sticker and how you can use the values in the array/structure for anything. The player is the only object in the scene.

source: GitHub - doug13579/Zombie-Spawner

This uses 3 objects, a player with no behaviors, a zombie with 3 animations, the destroy outside of screen (it’s not needed but it’s always a good idea to use when needed), a text object with the sticker behavior to stick the text to the zombie object.

variables

FYI: To download the zip click the green code button and download zip. Unzip and open the JSON file.

1 Like

As for the Tween, this is what I meant.

For this example, I had to change the text object’s sticker behavior to “only follow position”

1 Like

Holy cow that’s a lot of effort props! I’m just some random dude on the internet thanks!

1 Like

You’re welcome. I like helping and we’re all just random dudes helping each other. :grin:

That needs to go on a t-shirt. “I’m just some random dude from the internet”

2 Likes

I think and hope thats already a thing :joy:

1 Like