[SOLVED] How to create enemy sprites that shoot?

Hello everyone!
I have a new problem, since there is something wrong with double triangle collisions(A big collision problem - #12 by Angel), I decided to change my enemy. Now I have a fixed sprite that must fire a shot with a constant frequency and always in the same place … How can I do it?
Thanks so much for your valuable help! :slight_smile:

Double triangle collisions? :thinking:
I took a look at your linked post but didn’t understand everything…
Anyway, to shoot, start a timer, and when timer exceeds the desired rate of fire, create a bullet object, add a force to move it as you like, and reset the timer.

1 Like

Look at the penultimate comment, I created the bulb with 2 luminous triangles (the one in the photo has 1), and I created a collision mask that follows the two “rays” of the bulb … But, Gdevelop the collision puts it to me on the other hand, and I couldn’t understand why

Thanks a lot, after I try :slight_smile:

I think I did something wrong, can you help me?

What makes you think that? It looks okay.

1 Like

It doesn’t work, it doesn’t create bullet :frowning_face:

Maybe it is created but just not visible. Have you confirmed in the debugger?

1 Like

What do you mean? :thinking: From the debugger it gives me this
Senzanome

It says you have 2 instances of the object, so the creation works. But it’s on the base layer with a z order of 0, so if you have any background, it’s hidden beneath it. Put it on another layer or change the z order.

1 Like

You’re right, that’s the problem, but now the laser comes out somewhere else, not where I put the coordinates…
Is there an easy way to insert the laser where the “laserguns” are? maybe even in the directions where the laser guns are pointing?

create a point on the guns object and create your laser there, but you will have to figure out the angle.

1 Like

Sorry, but I don’t think I understand what a point is
I was thinking, could this be done with a variable that controls the position of the object and “says” where the laser is to be created? In this case, could one code be used for multiple lasers in each scene?

Points are in the object properties, next to hitbox.

1 Like

Could you, if you have time and desire, show me an example?

image

1 Like

Thanks a lot I understand! It was much simpler than when I thought!

1 Like

Good conversation :sunglasses: