Bullet from a Variable

Hey everyone.

Just getting started on my GDevelop journey.

Is there a way, using the Fire Bullet extension, to make it so that the bullet fired is called from a variable?

Explaining:

I have a tower that should shoot at enemies when they come to their range. But I have different towers, with different ranges and different particles.

I have a group called enemies, a group called towers, and wanted to have a group called bullets. Inside the tower, there is avariable “Bullet”, which would have the name of my bullet object.

Except that in the “bullet” I have to enter the object, and can’t use a variable for it =/

image

Does any1 know if there is a solution to this?

Thanks!

I didn’t understood well why you want to do that. But if is what i think you wanna just change the type of bullet based on the tower, right?

NO you need to put there object
I think there would be a way to go with groups yet i don’t have idea for now how to influence which object from group is used in this case

The idea would be not to need Tower logic for every single tower, but make one group logic for all towers and have them fire their respective bullets, but apparently this isn’t possible using this extension.

I’m trying to do it with Create Object from Name, but then have to do some weird stuff to get the bullet to the target.

Using Homing Projectiles, but it has some weird behaviors :smiley:

Yeah, tried with groups and couldn’t find that solution, which one from the group would be picked

Then what you need to do is a basic Skin system for your bullets, i use it for my game and it’s literally quite simple to do it, you just need to make one object called “Bullets” and add all bullets only in that object, you don’t need to create more objects, then add all bullets you want per Animation, so Bullet TowerA, Bullet TowerB etc… Then go in events where the tower fire and set a condition:
“Tower Has just fired”
Action
“Change the animation of the bullet name X”

Should be something like that:

If you want every bullet have a different pattern, then you need to go in condition and set:
“Bullet animations = TowerA”

Action:
“Whatever you want”

2 Likes

That’s actually a great way to look at it, I will try!
Thanks!!

1 Like